|
![](/i/fill.gif) |
In article <3fe21524@news.povray.org> , Wolfgang Wieser <wwi### [at] gmx de>
wrote:
> Okay, that explains all the strings one sees in the binary when turning
> on RTTI. It is probably responsible for most of the size overhead when
> using RTTI.
>
> But what do we need the type name string for? (..in a binary!)
> [Apart from an error message.]
Nothing, really, except debugging (hand hardly for that). One problem in
the C++ standard is that the string is completely implementation defined. A
compiler could even return an empty string and conform to the standard. Or
return the same string for every class. Only the type_ info comparison
functions are of any real use. Another big problem is that the C++ standard
does not guarantee that there only will be one type_info object for one
class.
That said, most compilers supply the class name in the name string.
> What you did not mention is some sort of tree structure. I'm not
> sure about the details, but isn't there the need for a tree traversal
> to decide if the dynamic_cast is valid? (Think of multiple inheritance...)
No, you just search through a list. That list is (in general, but
necessarily for every case - it may be shorter) as long as the total number
number of classes a class inherited from. This has to do with the common
vtable structure. How exactly it is implemented of course all depends on
your compiler runtime library implementation. You may want to check if
source code is provided for it (many vendors do provide source code).
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
![](/i/fill.gif) |