[omniORB] non-virtual destructors

David Riddoch djr@uk.research.att.com
Thu, 16 Mar 2000 14:49:26 +0000 (GMT)


> David Riddoch wrote:
> 
> > No.  This is perfectly legal c++ code, and in my opinion the compiler
> > should not issue a warning.  These objects are only ever 'delete'd through
> > a pointer to the most derived type -- so we are sure to call the correct
> > destructor.  The behaviour with virtual destructors is identical, but has
> > a space and time cost.
> 
> did you measure this ? The space 'overhead' should be one pointer per
> vtbl, i.e. per class. This isn't worth mentioning, is it ? Time overhead
> depends largely how frequent these objects are destructed.

Okay space overhead not a huge deal (but slightly more than a couple of
pointers, since the code to call the destructor is more complex). These
objects are created and destroyed whenever objects are created and
destroyed, and relative to the rest of the costs of doing this, a virtual
destructor is not a big one.

However, I assert my right to make my code as efficient as I can, and
making lots of things slightly more efficient helps keep the ORB as a
whole nice and efficient.  I am not prepared to make my code less
efficient just to placate an unnecassary compiler warning.

Cheers,
David