[cxx-abi-dev] Deleted virtual functions

Lawrence Crowl crowl at google.com
Fri May 29 20:11:34 UTC 2009


On 5/29/09, Mark Mitchell <mark at codesourcery.com> wrote:
> Lawrence Crowl wrote:
> > > I do not think it would be a good idea to require that a
> > > compiler put __cxa_pure_virtual into the virtual table.
> > > For code-size optimization, having a simple NULL pointer
> > > is better.
> >
> > Why is this a concern?  The tables are in .rodata and bounded
> > by the number of distinct classes, which is generally quite
> > reasonable.
>
> On small embedded systems, every byte counts.  Period.
>
> For example, some of the new Luminary Micro ARM-based parts have
> 8K flash.  And, yes, people want to use C++ on such systems.

The issue wasn't importance, but effectiveness.

Hm.  I suppose if you are sharing virtual tables between classes
it could matter.

> > I am not convinced that a new compiler will be able to use an
> > old library in general.
>
> It may not.  But, that's up to the compiler.  If the ABI mandates
> that virtual table slots for deleted virtual functions *must*
> contain the address of __cxa_deleted_virtual that prevents
> what might be a good implementation choice on some systems.
> For example, someone might want to be able to use deleted virtual
> functions on an existing Linux distribution, without having to
> upgrade libstdc++.

I do not object to the flexibility.  However, I would prefer the
choice to require the __cxa_deleted_virtual be available to the
programmer.  Admittedly, this is quality-of-implementation.

-- 
Lawrence Crowl



More information about the cxx-abi-dev mailing list