The GC, destructors, exceptions and memory corruption
Vladimir Panteleev
vladimir at thecybershadow.net
Fri May 13 01:34:06 PDT 2011
On Fri, 13 May 2011 11:25:01 +0300, 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.
How would you distinguish the two in the language? Class destructors =
finalizers?
Come to think of it, SafeD shouldn't allow accessing anything on the heap
in finalizers as well...
--
Best regards,
Vladimir mailto:vladimir at thecybershadow.net
More information about the Digitalmars-d
mailing list