[cxx-abi-dev] When to emit deleting destructor

Mark Mitchell mark at codesourcery.com
Wed Oct 16 15:04:47 UTC 2002



--On Wednesday, October 16, 2002 07:55:40 AM -0700 Mark Mitchell 
<mark at codesourcery.com> wrote:

>>   [3] Change deleting destructors for non-virtual destructors to be
>> optional and caller-produced (in it own COMDAT group) like the allocating
>> constructors (C3).
>
> The ways you can make use of such a thing are very limited.  (I think
> you know this, but just so that everyone understands the implications...)
>
> If you ever emit a call to the optional deleting destructor, you are
> depending on the deleting destructor being around, which you can't be
> sure will happen if some other compiler compiles the destructor.  So,
> this works only when the destructor definition is visible to you at the
> time that you are processing the delete expression.

This isn't strictly true; you can generate a D0 destructor that does,
approximately:

  operator delete(this);
  D1(this);

So, I guess this proposal provides some code size optimization
opportunities.

OK, I'll amend my proposal to be Scott's -- namely that an implementation
can choose to emit D0 destructors for a class with a non-virtual
destructor, and that if it does so they must have vague linkage.

Objections?

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



More information about the cxx-abi-dev mailing list