Does D provide automatic dereferencing for accessing members through pointers?

Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 27 14:17:08 PDT 2014


On Wednesday, 27 August 2014 at 19:36:08 UTC, Brian Schott wrote:
> On Wednesday, 27 August 2014 at 19:25:42 UTC, Gary Willoughby 
> wrote:
>> Why don't you need to dereference the pointer 'foo' to reach 
>> its member 'bar'?
>
> The compiler inserts the dereference for you. (It knows which 
> types are references and which are values and can do this 
> correctly) This makes the syntax consistent between value and 
> reference types.

Awesome. Ta.


More information about the Digitalmars-d-learn mailing list