|
uncaught_exception doesn't work with Dinkumware
|
11/13/2017 2:30 PM
post118198
|
uncaught_exception doesn't work with Dinkumware
The std::uncaught_exception() function seems to always return 0 when using the Dinkumware library on QNX 6.6.0.
Attaching a code example from http://en.cppreference.com/w/cpp/error/uncaught_exception.
When compiled with the default Dinkumware library:
qcc -o uncaught_exception_test2.o "..\\uncaught_exception_test2.cpp" -V4.7.3,gcc_ntoarmv7le -w1 -c -O0 -g
qcc -o uncaught_exception_test2 uncaught_exception_test2.o -V4.7.3,gcc_ntoarmv7le -w1 -lang-c++ -g
The results are wrong:
Exception thrown
~Foo() called normally
Exception caught: test exception
~Foo() called normally
The problem exists on both x86 and armv7.
When compiled with GNU libstdc++:
qcc -o uncaught_exception_test2.o "..\\uncaught_exception_test2.cpp" -V4.7.3,gcc_ntoarmv7le_gpp -w1 -c -O0 -g
qcc -o uncaught_exception_test2 uncaught_exception_test2.o -V4.7.3,gcc_ntoarmv7le_gpp -w1 -lang-c++ -g
The results are correct:
Exception thrown
~Foo() called during stack unwinding
Exception caught: test exception
~Foo() called normally
|
|
|