Question:
I’m using a catch(exception e). When I come in the catch-block and print the message belonging to the exception, I receive the message “9exception.” What does it mean?
Answer:
The exact textual description of C++ exception is compiler-dependent. The Standard requires that they be null-terminated C-strings, but nothing more. Therefore, you need to consult your compiler’s manuals or online help to gather more information about the meaning of this particular exception description.
However, you can detect the exact type of your exception object using Runtime Type Information (RTTI). This is sufficient for most purposes:
catch(exception & e){ cout << typeid(e).name(); // display the actual type of e}
It's highly recommended to catch exceptions by reference (as in my example), rather than by value.