且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当我抛出异常时会发生什么?

更新时间:2022-05-30 05:21:51

如果引发异常,则所有函数都将退回到该点在其中找到匹配类型 catch try ... catch 块。如果未从try块内调用您的函数,则程序将以未处理的异常退出。

If you throw an exception, all functions will be exited back to the point where it finds a try...catch block with a matching catch type. If your function isn't called from within a try block, the program will exit with an unhandled exception.

签出 https://isocpp.org/wiki/faq/exceptions 了解更多信息。