OSNews article about C++09 degenerates into C++ vs. D discussion

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Mon Nov 20 05:57:24 PST 2006


Miles wrote:
> Don Clugston wrote:
>> However, the use of GC instead of malloc enables advanced language
>> constructs (especially, more powerful array syntax), which greatly
>> reduce the number of memory allocations which need to be made.
> 
> Could you explain precisely what GC enables that is not possible with
> malloc? This just doesn't compute for me.

Array slicing, for one.
While technically possible with malloc, it would require maintaining a 
reference count and an extra pointer to the start of the allocated 
memory area to call free() on. And that still doesn't solve the problem 
of cyclic references (if the array doesn't just contain primitive data), 
as well as requiring synchronization in multi-threaded applications.



More information about the Digitalmars-d mailing list