Does D provide automatic dereferencing for accessing members through pointers?

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Aug 28 22:04:15 PDT 2014


On Fri, Aug 29, 2014 at 04:37:37AM +0000, Andrew Godfrey via Digitalmars-d-learn wrote:
> On Friday, 29 August 2014 at 02:10:46 UTC, H. S. Teoh via
> Digitalmars-d-learn wrote:
> >In D you just use '.' throughout and it Just Works(tm).
> 
> Unless the property you're accessing is also a pointer property, like
> sizeof. Then you have to be careful.

True. Though if you're writing generic code, chances are that what you
want is the pointer size rather than the size of the referenced object.
You only really get into trouble when you have to explicitly work with
pointers.


[...]
> Do pointers have any other cases like this besides 'sizeof'?
> I couldn't find a list of pointer properties in the docs (whereas I
> know where the list of array properties is).

Probably here?

	http://dlang.org/property.html


T

-- 
Time flies like an arrow. Fruit flies like a banana.


More information about the Digitalmars-d-learn mailing list