how to specify no vtable for a class ?

John (Eljay) Love-Jensen
Thu Aug 31 15:57:00 GMT 2006

Hi Vincent,


> Do you think that this pragma [#pragma interface] can help ?

Since I don't know what the problem is you are encountering, I cannot say if following the contemplation by that website and enhancing GCC itself with the facilities to simulate __declspec(novtable) by embellishing what the "#pragma interface" does would help.

To me, that appears to be a lot of work to add an extension to GCC.  Is that kind of work worth it?  You'd have to tell me what the problem is for me to give my opinion on undertaking such an endeavor.

Off the top of my head and without information on the backstory of the problem you've run into, I think the MSVC++ __declspec(novtable) optimization is, itself, questionable.  I would not use it in my code without a compelling reason to use it.  That "compelling reason" would be one that is uncovered through profiling my code.

If my code was spending 10% of its time in unnecessary abstract base class vtable initializations, it might be worth it.

If my code was spending 1% of its time in unnecessary abstract base class vtable initializations, that doesn't seem worth it (considering how much work would be involved to "fix" the compiler to accommodate this non-compliant behavior).

Before I were to change the compiler, I'd consider alternative C++ friendly strategies such as using Generic Programming techniques to perform compile time polymorphism, which would make that optimization moot.


More information about the Gcc-help mailing list