All my main() functions look the same:
Code:
int main(int argc, char** argv)
{
using namespace std;
try {
return main_program(argc,argv);
}
catch (runtime_error& e) {
cerr << RED << "Run-time error : " << e.what() << NORMAL << endl;
}
catch (bad_alloc&) {
statusFailed();
cerr << RED << "Out of memory." << NORMAL << endl;
}
catch (exception& e) {
cerr << RED << "Exception : " << e.what() << NORMAL << endl;
}
catch (...) {
cerr << RED << "Unknown error" << NORMAL << endl;
}
return 1;
}
Then main_program takes the role of the main function.