Help save net neutrality! Learn more.
Close

CppUnit 1.6.x/MSVC without RTTI?

Stan Accy
2001-10-31
2001-11-02
  • Stan Accy

    Stan Accy - 2001-10-31

    Is it possible to use CppUnit 1.6.x under MSVC6 without having C++ RTTI enabled?

    If not, would it be worth adding our own RTTI since not all platforms/compilers support RTTI, and having RTTI enabled can lead to some signficant performance probs?

    Nick

     
    • Bastiaan Bakker

      Bastiaan Bakker - 2001-11-01

      Have a look at include/cppunit/config-msvc6.h: it contains a flag CPPUNIT_HAVE_RTTI. If you #undef it, CppUnit will not use RTTI dependent features. Use the appriopate compiler flag to disable RTTI in MSVC++ itself.

      Good luck,

      Bastiaan

       
    • Stan Accy

      Stan Accy - 2001-11-01

      Thanks Bastiaan.

      What functionality, if any, do you lose by disabling RTTI?

      Nick

       
      • Baptiste Lepilleur

        TestCase name extraction: the type passed to the CPPUNIT_TESTSUITE macro is used. Not much a bother unless you are using templatized test case.

        More important, is the loss of the use of the MFC Test Runner which rely on dynamic_cast to distinguish between TestSuite and TestCase (a design in CppUnit if you ask me).

        Baptiste.

         
        • Stan Accy

          Stan Accy - 2001-11-02

          Would it not be worth adding a class name field to each class, and effeectively emulating our own RTTI? We would have to switch() on the class name, but I think this is a small price to pay for something that would be reliably cross platform and portable?

           

Log in to post a comment.