Hi!

I'm having problem with using RTTI when compiling with gcc 4.0.2.
Is there any flags I should use when compiling? (tried -frtti)
Read somewhere that I should include <typeinfo> in the headers... but in which headers? All headers
in the project?

I thought that it was turned in as default. But when I use dynamic_cast it lets me cast to wathever...

take this for example:
Qt Code:
  1. class Thing ( base class, polymorphic )
  2.  
  3. class Contour class Polygon ( subclasses of Thing )
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. Thing *thing = new Contour ( );
  2.  
  3. /* This should work */
  4. Contour *con = dynamic_cast<Contour*) ( thing );
  5. if ( con == NULL )
  6. std::cout<<"con==NULL"<<std::endl;
  7.  
  8. /* this should return a NULL pointer */
  9. Polygon *pol = dynamic_cast<Polygon*) ( thing );
  10. if ( pol == NULL )
  11. std::cout<<"pol==NULL"<<std::endl;
To copy to clipboard, switch view to plain text mode 

No of the two returned casts are NULL. From what I understand, the second cast should be NULL since I try to cast a Contour to a Polygon.

This kind of things just makes me sad...
pir