James Robinson wrote:
> What's the benefit of omitting the virtual destructor?

The benefit is that the destructor stays out of the vtable, which will
potentially reduce the vtable size and save a layer of indirection.  I
don't consider either of these advantages compelling.  I agree that
it's overshadowed by the bugs that occur when a caller expects virtual
destructor semantics but they're not available.

The style guide recommends always providing an empty virtual
destructor in interface classes.

http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Interfaces#Interfaces

"To make sure all implementations of the interface can be destroyed
correctly, they must also declare a virtual destructor (in an
exception to the first rule, this should not be pure)."

but again, there are valid uses where this is not strictly required.

Mark

-- 
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev

Reply via email to