1-12-6 栈反解时再次异常

1.12-6 栈反解时再次异常

#include <iostream>
<!--more-->
#include <exception>
using namespace std;

class BadIdea
{
public:
~BadIdea()
{
throw logic_error("This is a bad exception");
}
};

void my_terminate()
{
cout << "This is a bad Idea" << endl;
exit(0);
}
void *psource = (void *)set_terminate(my_terminate);

int main(int argc, char const *argv[])
{
try
{
BadIdea ba;
throw logic_error("test");
}
catch (const std::exception &e)
{
std::cerr << e.what() << '\n';
}

return 0;
}