This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: virtual table layout on i386
- To: adriang at adriang dot ce dot mediaone dot net, egcs at egcs dot cygnus dot com
- Subject: Re: virtual table layout on i386
- From: mrs at wrs dot com (Mike Stump)
- Date: Mon, 28 Dec 1998 11:53:58 -0800
> Date: Tue, 22 Dec 1998 08:08:53 -0600 (EST)
> From: <adriang@adriang.ce.mediaone.net>
> To: egcs@egcs.cygnus.com
> I'm on Linux on Intel processor. I noticed that the virtual table
> has the first two slots reserved, the first virtual function that I
> include in the class, occupying third position (offset 8). Question:
> what are the first two slots reserved for (rtti? virt
> destructor?). How likely is it to change in egcs?
If you consider it 100% likely, you will be able to write portable
code and not get burned. The second you start guessing and assuming
things about the vtable layout, you will get burned. You can write
non-portable code, if you wish, you assume the responsibility and
liability. Having said that, the format has virtually been fixed for
a decade, with just one change (for thunks).
Yes, the `extra' slot at the front is for rtti.