layout of the g++ virtual tables

Mike Stump mrs@wrs.com
Wed Aug 5 13:26:00 GMT 1998


> Date: Wed, 5 Aug 1998 11:07:55 +0200
> From: Cyrille Comar <comar@act-europe.fr>

> I was wondering if there was some type specific information stored
> along with the virtual table.

Yes.  RTTI (if compiled with -frtti (which is the default)) is
included in all objects that have at least one vtable pointer.  There
you can get at things like the ``name'' of the class, the type
involved, base classes and the like.

In this case, I'll point you at the code.  See tinfo*.cc in the
compiler.

> In GNAT we store plenty of other information used among other thing
> to check the validity of the downcasts

This can be done.

> Wouldn't the first 2 words be used for something like that by any
> chance?

Yes.



More information about the Gcc mailing list