vcall offset description

Jim Dehnert dehnert at baalbek.engr.sgi.com
Tue Apr 4 19:52:37 UTC 2000


> From: Mark Mitchell <mark at codesourcery.com>
> 
> I noticed some red ink in the vcall offset description:
> 
>   Virtual call (vcall) offsets are used to perform pointer adjustment
>   for virtual functions defined in a virtual base class or its
>   subobjects, and overridden in a class derived from it.
> 
> I think we need the vcall offsets even if the function is not
> overridden.  Otherwise, when the same base appears as a virtual base
> in two different hierarchies, its vtable layout might be different.
> Then, if a single hierarchy combines both uses, everything will get
> confused.  So, I think the last clause (`and overridden ...') should
> go.  Sound right?

Yes and no.  This sentence describes what vcall offsets are and how
they are used, and is correct -- they are not used unless the virtual
function is actually overridden.  Later, the virtual table layout
description for Category 3 describes what entries are present:

  ... the vtable for a virtual base A also includes a
  vcall offset entry for each virtual function represented in A's
  primary vtable and the secondary vtables from A's non-virtual bases.
  The vcall offset entries are allocated from the inside out, in the
  same order as the functions appear in A's vtables.

So the vcall offsets are present, as you understood, for all vptrs,
whether or not overridden (and therefore used).

The confusion stems from our separation of the description of vtable
components and order from the description of exactly what is contained
in various vtables.  I'm reluctant to remove that separation, because I
think it allows each part to be clearer -- but it certainly means that
you can't read just one section and understand.  I'll try to clarify
that in the introductory paragraph.

Jim

-	    Jim Dehnert		dehnert at sgi.com
				(650)933-4272




More information about the cxx-abi-dev mailing list