ommitting vtables

Harri Porten kde-optimize@mail.kde.org
Mon, 13 Jan 2003 01:14:40 +0100 (CET)


On Mon, 13 Jan 2003, Dirk Mueller wrote:

> On Son, 12 Jan 2003, Harri Porten wrote:
> 
> > I just remembered a MSVC extension (__declspec(novtable)) that stops the
> > compiler from generating code for a class' vtable. Useful for abstract
> > classes like interfaces. 
> 
> But when those interface classes get an implementation, you'll need a vtable 
> for them ?!

Yes. The attribute only affects the base class. The vtable itself may
still be emitted but there'll be no initialization code in the class's
constructor. Also, the linker can drop the vtable w/o any reference.

Harri.