O
Old Wolf
Is it possible to portably get the typename of an exception
that occurred?
I noticed when an uncaught exception occurred, GCC (3.4.1)
displayed:
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
So I tried:
catch(std::exception &e) {
std::cerr << "[E] Exception (" << typeid(e).name()
<< ") thrown: " << e.what() << std::endl;
}
but got output:
[E] Exception (St11logic_error) thrown:
basic_string::_S_construct NULL not valid
ie. it said St11logic_error instead of std::logic_error. Do
I have to try using a compiler-specific unmangling function?
that occurred?
I noticed when an uncaught exception occurred, GCC (3.4.1)
displayed:
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
So I tried:
catch(std::exception &e) {
std::cerr << "[E] Exception (" << typeid(e).name()
<< ") thrown: " << e.what() << std::endl;
}
but got output:
[E] Exception (St11logic_error) thrown:
basic_string::_S_construct NULL not valid
ie. it said St11logic_error instead of std::logic_error. Do
I have to try using a compiler-specific unmangling function?