RTTI draft proposal

Jason Merrill jason at cygnus.com
Thu Aug 26 08:07:58 UTC 1999


>>>>> Daveed Vandevoorde <daveed at edg.com> writes:

 >>  > 6. std::__qualifier_type_info is similar to std::__pointer_type_info but
 >>  > describes top level qualifiers as in "int const" and "char *const".
 >> 
 >> Where would this be used?  I included it in the G++ implementation, but
 >> have since come to the conclusion that it was a mistake.

 > How do you check qualification conversions when catching exceptions?

Qualification conversions only apply to pointers, and you already record
the qualification of a pointer's target type in the info about the pointer
type.

 >> In a typical downcast, the offset from src to dst will be negative.

 > Is the architecture biased? I.e., do we care about the sign convention
 > for this value?

Dunno; I just meant that you shouldn't have magic negative values for
src2dst_offset.

 >> FWIW, g++ turns all dynamic_casts into upcasts, using the original pointer
 >> for disambiguation.  I'm not yet convinced that there's a good way to
 >> accelerate downcasts.

 > I'm afraid you may be right.  Except perhaps that checking if a base
 > of type T is at the offset guessed by the base-to-derived cast may
 > be more efficient than a full-fledged complete-to-base conversion.

That makes sense.  When we dynamic_cast from V* to T*, if we see that T has
a public nonvirtual base of type V, we pass the offset from a T to a V into
__dynamic_cast.  In __dynamic_cast, we walk through the T bases, and if we
find one at the right position, we're done.

So I guess it does make sense to have magic negative values.

Jason




More information about the cxx-abi-dev mailing list