Does it make sense to catch exceptions in the main(…)?

前端 未结 7 746
攒了一身酷
攒了一身酷 2020-12-16 17:50

I found some code in a project which looks like that :

int main(int argc, char *argv[])
{
  // some stuff

 try {
  theApp.Run();
 } catch (std::exception&a         


        
相关标签:
7条回答
  • 2020-12-16 18:28

    This is a global catch block. It is common for displaying a nice and user understood message ('Internal error') instead of a cryptic exception print-out. This may be not evident from the specific code block, but it is in general a good idea.

    0 讨论(0)
提交回复
热议问题