C++ set_terminate函数不适用于我
以下代码取自:C++ set_terminate函数不适用于我,c++,terminate-handler,C++,Terminate Handler,以下代码取自: //设置\u终止示例 #包括 #包括 #包括 使用名称空间std; void myterminate(){ CUT< P>一种可能性——如果你在VC++调试程序中运行程序,调试器捕获未处理的异常,它可能不会返回控制程序来运行MyDealTest.尝试在VisualC++中运行程序. yUP .用Ctrl +F5启动程序. @ BJSKISUROR123:不,这是一个特性: // set_terminate example #include <iostream> #in
//设置\u终止示例
#包括
#包括
#包括
使用名称空间std;
void myterminate(){
CUT< P>一种可能性——如果你在VC++调试程序中运行程序,调试器捕获未处理的异常,它可能不会返回控制程序来运行MyDealTest.尝试在VisualC++中运行程序. yUP .用Ctrl +F5启动程序. @ BJSKISUROR123:不,这是一个特性:
// set_terminate example
#include <iostream>
#include <exception>
#include <cstdlib>
using namespace std;
void myterminate () {
cout << "terminate handler called\n";
abort(); // forces abnormal termination
}
int main (void) {
set_terminate (myterminate);
throw 0; // unhandled exception: calls terminate handler
return 0;
}