This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: virtual table layout on i386
- To: egcs at egcs dot cygnus dot com
- Subject: Re: virtual table layout on i386
- From: adriang at campbellsoft dot com
- Date: Tue, 29 Dec 1998 11:29:09 -0600
Can anyone elaborate on the 'just one change (for thunks)'? (mentioned towards
the end of the message)
Also, I identified two 'reserved' slots in the vtable and I understand that at
least one is used for rtti. Does rtti use both slots? If no, what is the second
one for?
thanx
> Date: Tue, 22 Dec 1998 08:08:53 -0600 (EST)
> From:
> 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.