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

Jacob Carlborg doob at me.com
Tue Oct 18 04:09:51 PDT 2011


On 2011-10-18 12:50, Trass3r wrote:
>> 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).

The GC can be replaced at link time. Tango contains an example of a GC 
that uses malloc, should work with druntime as well. Another option is 
to not link a GC at all, then there will linker errors when using 
something that needs the GC.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list