2004
/******************************************************************************/ /* */ /* FILE: july.cpp */ /* */ /* Another strange aspect of C++ exception handling */ /* ================================================ */ /* */ /* Compiled and tested with g++ 3.2.3 20030415 */ /* */ /* V1.00 31-JUL-2004 P. Tellenbach http://www.heimetli.ch/ */ /* */ /******************************************************************************/ #include <iostream> #include <exception> #include <cstdlib> using namespace std ; void handler( ) { try { throw ; } catch( const char *ps ) { cout << ps << endl ; } exit( 0 ) ; } void func() throw( ) { throw "Hello world !" ; } int main() { set_unexpected( handler ) ; func() ; return 0 ; }