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

前端 未结 7 776
攒了一身酷
攒了一身酷 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:22

    According the the Windows spec, the main isn't allowed to throw. (practically it results into the message that asks if you want to send the bug-report to Microsoft)

提交回复
热议问题