Does D provide automatic dereferencing for accessing members through pointers?

Brian Schott via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 27 12:36:06 PDT 2014


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.



More information about the Digitalmars-d-learn mailing list