Is this considered good programming practice in C++:
try {
// some code
}
catch(someException) {
// do something
}
catch (...)
{
// left empty <-- Good Practice???
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No! That is a terrible practice!
Just about the only time you should
catch (...)and not rethrow the exception would be inmain()to catch any otherwise unhandled exceptions and to display or log an error before exiting.If you
catch (...), you have absolutely no idea what exception was thrown, and thus you can’t know whether it is safe to continue running.