[cxx-abi-dev] deleting destructors

Mark Mitchell mark at codesourcery.com
Mon Sep 30 04:06:43 UTC 2002


> I have a question about delete destructors (D0).  Must they handle being
> passed a null this pointer?

This is a good question; it is unspecified at present.

G++'s D0 destructors do not handle a NULL this pointer.

What do HP and Intel do?

> I also believe that for a class with no virtual bases the C1 and C2
> constructors have identical effect (and similarly for the D1 and D2
> destructors).  So when constructing (destructing) a base or member
> subobject that has no virtual bases either constructor (destructor) may
> be used.

You're correct that the C1/C2 and D1/D2 variants will behave identically
in this case.  I don't see why an implementation would have to call one,
rather than the other.  However, the implementation must *emit* both
symbols; you can't optimize away the subobject version.  (There's no
particularly good reason for this, but there's nothing in the ABI that
says that you can optimize away the subobject constructor.)  You can,
of course, make both symbols mark the same location.

-- 
Mark Mitchell                mark at codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com



More information about the cxx-abi-dev mailing list