POV-Ray : Newsgroups : povray.programming : Improved intersection routine for CSG-Intersection objects : Re: Improved intersection routine for CSG-Intersection objects Server Time
8 Jul 2024 19:29:52 EDT (-0400)
  Re: Improved intersection routine for CSG-Intersection objects  
From: Thorsten Froehlich
Date: 18 Dec 2003 16:57:47
Message: <3fe222db$1@news.povray.org>
In article <3fe21524@news.povray.org> , Wolfgang Wieser <wwi### [at] gmxde>  
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] trfde

Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.