catch(...) , ( )
-, . , std::exception, No-No, main():
int execute(void);
int main(void)
{
try
{
return execute();
}
catch(const std::exception& e)
{
std::cerr << "Unhandled exception: " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch(...)
{
std::cerr << "Unknown exception!" << std::endl;
return EXIT_FAILURE;
}
}
" ", . - catch, , - Bad Thing. , ; "- , , !" , .
- , , . , RAII. , , - , , .