auto classes and finalizers

kris foo at bar.com
Sun Apr 9 21:18:45 PDT 2006


Regan Heath wrote:
> On Sun, 09 Apr 2006 19:27:09 -0700, kris <foo at bar.com> wrote:
>> On the other hand, all these concerns would melt away if the GC were  
>> changed to not invoke the dtor (see related post). The beauty of that  
>> approach is that there's no additional keywords or compiler behaviour;
> 
> 
> True, however the beauty is marred by the possibility of resource 
> leaks.  I'd like to think we can come up with a solution which prevents 
> them, or  at least makes them less likely. It would be a big step up 
> over C++ etc  and if it takes adding a keyword and/or new compiler 
> behaviour it's a  small price to pay IMO.

Regarding leaks, please see related post entitled "GC & dtors ~ a 
different approach" ?

I just hacked up the collector in Ares to do what is described in that 
post. The quick hack doesn't do the leak-detection part, but the rest of 
it works fine (there may well be cases I've overlooked but the obvious 
ones, 'delete' and raii, now invoke the dtor whereas normal collection 
does not).



More information about the Digitalmars-d mailing list