c++ - 在哪个内存区域创建异常类实例?

标签 c++ exception

我找不到在异常处理过程中在哪里创建异常类实例的信息?在哪个内存区域(栈、堆、静态存储等)?我假设它不在堆栈上,因为堆栈展开......

最佳答案

来自标准:

15.2.4: The memory for the temporary copy of the exception being thrown is allocated in an unspecified way, except as noted in 3.7.3.1.

3.7.3.1 说:

3.7.3.1: All objects which neither have dynamic storage duration nor are local have static storage duration. The storage for these objects shall last for the duration of the program (3.6.2, 3.6.3).

关于c++ - 在哪个内存区域创建异常类实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2252314/

相关文章:

c++ - 如何从另一个方法调用指向方法的指针

java - 未知协议(protocol) : c (JDOM a SAXBuilder)

c++ - 异常捕获机制,C++

c++ - vector 中重复的 unique_ptr 项的所有权错误

c++获取临时对象的地址

Python mechanize 不处理表单异常

c# - 如何忽略 Visual Studio 中异步方法的特定异常实例(抛出时中断)

java - 在 Java 中使用自定义异常类型包装异常是否有优势

c++ - 仅在 NetBeans 8.2 中“找不到 nvcc”

c# - 将 C# 集成到 C++ 中