This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: layout of the g++ virtual tables
> Wouldn't the first 2 words be used for something like that by any
> chance?
Both are used for the 'dynamic cast' and 'run-time type
identification' features. You can easily trigger its usage with
#include <typeinfo>
struct Foo{
virtual ~Foo();
};
struct Bar:Foo
{};
Foo *f()
{
return new Bar;
}
const char* g()
{
return typeid(*f()).name();
}
Bar* h()
{
return dynamic_cast<Bar*>(f());
}
(Breaking it into function, to trick compilation with -O2.
From the generated code, it appears that both g and h could
be compiled into a constant, otherwise)
Hope this helps,
Martin