Looking for documentation of D's lower-level aspects.

Trass3r un at known.com
Tue Oct 18 03:50:30 PDT 2011


>      ahead = n._next;
>
> The C/C++ equivalent of this is `ahead = n->next;`, or equivalently  
> `ahead = (*n).next;`. This is a difference in semantics from C/C++ with  
> respect to the `.`---it seems like D turns pointer to struct property  
> accesses into property access with indirection.

Yes. It was really dumb to introduce that in C back then cause you can't  
easily change from a pointer to a class to a real class without editing  
all places where it is accessed.
D chose the sane and safer way of letting the compiler figure out what to  
do.

> Nowhere that I can recall in Alexandrescu's book talked about this, but  
> it's a really big deal!

I can't recall where I read about it back then, but I did know it soon  
after I had started learning D.
Some of the differences to C/C++ are explained there:  
http://www.d-programming-language.org/ctod.html
Though it could use an overhaul.

As for getting rid of the GC, it is theoretically possible.
But nobody has put much effort into making it work yet (cause the only  
application platform is still x86/64).
I guess it will become necessary though once D conquers ARM (we can  
generate code for it with LDC/GDC but druntime isn't ready).


More information about the Digitalmars-d-learn mailing list