is_floating - RTTI specification.

Coleen Phillimore coleen at zko.dec.com
Wed Oct 13 18:56:49 UTC 1999


Daveed Vandevoorde wrote:
> 
> Coleen Phillimore wrote:
> >
> > In Daveeds RTTI paper, the defn of base class info is:
> >
> >    struct std::__base_class_info {
> >     std::type_info *type; /* Null if unused. */
> >     std::ptrdiff_t offset;
> >     int is_direct: 1;
> >     int is_floating: 1; /* I.e., virtual or base of virtual subobject. */
> >     int is_virtual: 1; /* Implies is_floating. */
> >     int is_shared: 1; /* Implies is_floating and the virtual subobject
> >                                  appears on multiple derivation paths. */
> >     int is_accessible: 1;
> >     int is_ambiguous: 1;
> >     };
> >
> > What is is_floating vs. is_virtual?
> 
> An example makes it clearer:
> 
>         struct B {};
>         struct V: B {};
>         struct D: virtual V {};
> 
> The base V is a virtual base of D and therefore its location with respect to
> the origin of a D object may "float".  The subbase B is not virtual, but
> because it is part of a virtual base subobject, it still has that "floating"
> attribute.

Oh, terminology skew.  I suppose "float"'s as good as any word to put it.

> 
> > This is the second reference I've
> > seen to "floating" base classes.  Can someone point to the description of
> > these?
> >
> > Also, I take it that "offset" is the offset in the vtable if the base
> > class is virtual, rather than real offset into the object?
> 
> That was not what I had in mind, but it would also work.  Do you see an
> advantage to that approach?
> 
>         Daveed

Well, it depends on if you're representing both indirect and direct base
classes in the RTTI.  If you're representing both, there's no advantage.
But if you're representing only direct and then using the RTTI for the direct
base classes to get to indirect classes, you can't put absolute offsets
to "floating"/virtual subobjects, 'cause they, uh, well, float.  The latter
is how our EDG compiler works today.  Only representing direct base clases
saves space, but costs time in dynamic cast and exception handling.

Also, the DEC object model has virtual base class tables today with
offsets to virtual base classes (like Microsoft) and instead of
putting the btable offsets in the RTTI, we put "thunks" to do the
conversions to virtual base classes.  With the vptr first in the object, 
we can probably just use the vtable(btable part) index as the offset, I think.

Coleen
-- 
-----------------------------------------------------------------------
Coleen Phillimore                  | mailto:coleen at zko.dec.com
Compaq Computer Corp.   Nashua, NH | COMPAQ C++ Compiler Development
-----------------------------------------------------------------------




More information about the cxx-abi-dev mailing list