digitalmars.D - Pointers to structures
- DLearner (4/4) Mar 19 2021 Could it be made acceptable, at least for -betterC option, to use
- Imperatorn (2/6) Mar 19 2021 You could try search and replace '->' with '.' see how it goes
- Cym13 (5/9) Mar 19 2021 In D '.' can be used to access the member of a struct regardless
Could it be made acceptable, at least for -betterC option, to use '->' as an alternative to '.'? 'ptrStructVar->MemOfStructVar' is a very common idiom in C. Best regards
Mar 19 2021
On Friday, 19 March 2021 at 11:23:36 UTC, DLearner wrote:Could it be made acceptable, at least for -betterC option, to use '->' as an alternative to '.'? 'ptrStructVar->MemOfStructVar' is a very common idiom in C. Best regardsYou could try search and replace '->' with '.' see how it goes
Mar 19 2021
On Friday, 19 March 2021 at 11:23:36 UTC, DLearner wrote:Could it be made acceptable, at least for -betterC option, to use '->' as an alternative to '.'? 'ptrStructVar->MemOfStructVar' is a very common idiom in C. Best regardsIn D '.' can be used to access the member of a struct regardless of whether you are manipulating the struct itself or a pointer to that struct. So you can just write 'ptrStructVar.MemOfStructVar' and it will work without any issue.
Mar 19 2021
On Friday, 19 March 2021 at 12:19:47 UTC, Cym13 wrote:In D '.' can be used to access the member of a struct regardless of whether you are manipulating the struct itself or a pointer to that struct. So you can just write 'ptrStructVar.MemOfStructVar' and it will work without any issue.i guess, idea was to reduce manual work then adapt C sources to D. i have similar wishes for "typedef ...". it is boring to rewrite it then making C binding.
Mar 19 2021
On Friday, 19 March 2021 at 13:15:16 UTC, novice3 wrote:On Friday, 19 March 2021 at 12:19:47 UTC, Cym13 wrote:Nobody needs to manually write bindings nowadays https://github.com/jacob-carlborg/dstep I use it to generate the bindings of the C headers libs i need Works most of the time, sometimes i have to do some cleanup, but it's faster than doing all the thing manually Alternatively one can use dpp https://github.com/atilaneves/dppIn D '.' can be used to access the member of a struct regardless of whether you are manipulating the struct itself or a pointer to that struct. So you can just write 'ptrStructVar.MemOfStructVar' and it will work without any issue.i guess, idea was to reduce manual work then adapt C sources to D. i have similar wishes for "typedef ...". it is boring to rewrite it then making C binding.
Mar 19 2021