Pointers to structures

Cym13 cpicard at purrfect.fr
Fri Mar 19 12:19:47 UTC 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 regards

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.


More information about the Digitalmars-d mailing list