How to turn this C++ into D?

luminousone via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 5 11:44:55 PST 2014


On Wednesday, 5 November 2014 at 19:05:32 UTC, Patrick Jeeves 
wrote:
> On Wednesday, 5 November 2014 at 18:56:08 UTC, luminousone 
> wrote:
>> unless delete is explicitly called, I don't believe the 
>> destructor would ever be called, it would still have a 
>> reference in the static foo_list object that would stop it 
>> from being collected by the gc.
>
> This is exactly why I asked about it, and even if delete is 
> explicitly called-- which i believe is deprecated, wouldn't the 
> runtime fill the space with the default construtor until the GC 
> decides to remove it? meaning it would be immediatly added back 
> into the list?

I don't believe that the default constructor is called. I am 
pretty sure delete immediately deallocates the object, 
deregistering its memory from the gc.

In fact I am 99% sure no constructor is called after delete, it 
would cause problems for objects with no default constructor, or 
for system related stuff done in constructors, and I haven't seen 
anything like that in my X11 work in d.



More information about the Digitalmars-d-learn mailing list