B
bb
Hi,
I am using gcc v4.0.2 on fedora core 4 (2.6.16). Any reason why the
handler set thru' set_unexpected() never gets called in the following
code?
--------- Code -------------
#include <iostream>
#include <exception>
#include <string>
void myHandler();
int main(int argc, char** argv);
int main(int argc, char** argv) {
std::set_unexpected(myHandler);
try {
throw std::string("This is an exception");
} catch (std::exception& ex) {
std::cout << "Expected exception caught" << std::endl;
}
}
void myHandler() {
std::cout << "Unexpected exception caught" << std::endl;
throw std::exception();
}
-------- Produces the following Output -------------
terminate called after throwing an instance of 'std::string'
Aborted
-------- End -----------------
I am using gcc v4.0.2 on fedora core 4 (2.6.16). Any reason why the
handler set thru' set_unexpected() never gets called in the following
code?
--------- Code -------------
#include <iostream>
#include <exception>
#include <string>
void myHandler();
int main(int argc, char** argv);
int main(int argc, char** argv) {
std::set_unexpected(myHandler);
try {
throw std::string("This is an exception");
} catch (std::exception& ex) {
std::cout << "Expected exception caught" << std::endl;
}
}
void myHandler() {
std::cout << "Unexpected exception caught" << std::endl;
throw std::exception();
}
-------- Produces the following Output -------------
terminate called after throwing an instance of 'std::string'
Aborted
-------- End -----------------