[cxx-abi-dev] Deleted virtual functions

Mark Mitchell mark at codesourcery.com
Mon Jun 1 21:45:23 UTC 2009


Sean Perry wrote:

> Another area I've had concerns about is the comparison for equality of
> the typeid operator (2.9.3). There is a statement that doing a straight
> address comparison is sufficient for testing equality.

There's no way to win completely on this issue.  Some people want types
with the same name in different shared libraries to be the same type;
other people don't.  For example, when building plugins, you often want
each shared library to be completely independent; if my plugin's "class
Plugin" is the same as your plugin's "class Plugin", very bad things happen.

The approach in the ABI is, in my opinion, close to optimal.  On a
system like Linux, you can mark things as exported from a shared
library, or not.  If you do, then the dynamic linker can merge the
addresses, and the types are "the same".  If you don't, then they're
not.  The programmer gets to choose.

On other systems (e.g., DLL-based systems) you have no choice but to use
string comparison.  In that case, you'll lose in the plugin case.  Yes,
we could document a variant of the ABI that does string-based comparison
if need be.

-- 
Mark Mitchell
CodeSourcery
mark at codesourcery.com
(650) 331-3385 x713



More information about the cxx-abi-dev mailing list