c++ - 如果未捕获异常会发生什么?

标签 c++ exception

我问的不是意想不到的异常,而是没有捕获到的异常。

崩溃了?还是终止了?

最佳答案

根据§15.3/9:

If no matching handler is found in a program, the function terminate() is called; whether or not the stack is unwound before this call to terminate() is implementation-defined (15.5.1). Emphasis mine

之后会发生什么取决于您的操作系统。在实践中:崩溃。 (或者如果你在调试器中,“嘿,你没听清楚。”)

关于c++ - 如果未捕获异常会发生什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2633193/

相关文章:

c++ - 不明白这段代码原理

c++ - 为什么 free() 函数不将内存返回给操作系统?

C++ Ogre,不会编译和运行

c++ - 从类中提供指向私有(private)成员的指针

android - 将 SimpleCursorTreeAdapter 用于 ExpandableList 会产生错误 "Failed to read row 0, column -1"。找不到错误

c - C 中的读取访问冲突,试图找到源代码

c++ - 两阶段名称查找 : PODs vs. 自定义类型

java - 什么是堆栈溢出错误?

c++ - std::hash::operator() - 异常保证在哪里?

exception - 为什么我无法捕获 EJB 异常?