gpt4 book ai didi

c++ - 终止抛出异常的处理程序

转载 作者:行者123 更新时间:2023-11-30 04:00:52 26 4
gpt4 key购买 nike

<分区>

我们假设以下代码:

#include <exception>
#include <stdexcept>
#include <iostream>

using namespace std;

int main()
{
set_terminate([]{throw runtime_error("");});
throw runtime_error("oops");
}

N3797, §18.8.3.1 [terminate.handler] /2: Required behavior: A terminate_handler shall terminate execution of the program without returning to the caller.

这是未定义的行为。实际上会发生什么?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com