Destructors vs. Finalizers

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 26 08:15:03 PDT 2017


On 7/26/17 10:57 AM, Guillaume Piolat wrote:

> I'll defend the view point that there is _nothing_ useful to do in a 
> finalizer except to check if the destructor has already been called.

For instance, a destructor could destroy recursively all members at that 
time.

A finalizer would not be able to.

The thing to do in a finalizer that is useful is to release any non-GC 
resources.

-Steve


More information about the Digitalmars-d mailing list