The GC, destructors, exceptions and memory corruption

Sean Kelly sean at invisibleduck.org
Fri May 13 09:46:17 PDT 2011


They effectively are. When a finalized throws its wrapped in a FinalizerError or something of the sort. This is old code from when Walter said that it should be illegal for a finalizer to throw (rule should be revised with new chaining rules, but it works for now). 

Sent from my iPhone

On May 13, 2011, at 1:25 AM, Don <nospam at nospam.com> wrote:

> Alexander wrote:
>> On 13.05.2011 06:53, Vladimir Panteleev wrote:
>>> Thus, my question is: what's the expected behavior of D programs when a destructor throws?
>>  I would say, the only expected (and correct, IMHO) behavior should be termination of the program because of unhandled exception.
>> /Alexander
> 
> Are you talking about *finalizers* or *destructors* ?
> 
> Throwing from inside a destructor should definitely work (unlike C++).
> But finalizers should probably be nothrow.


More information about the Digitalmars-d mailing list