为什么程序在没有try/catch的情况下失败?

dys*_*ree -4 c++ try-catch visual-studio-2010

我在发布配置中使用VS2010和C++

以下执行正常:

int status;
try
{
    status = myfunction(arg1, arg2);
}
catch (int e)
{
    cout << "An exception occurred. Exception Nr. " << e << endl;
}
Run Code Online (Sandbox Code Playgroud)

但是,以下程序崩溃了:

int status;
status = myfunction(arg1, arg2);
Run Code Online (Sandbox Code Playgroud)

发生了什么?
我没有方法的来源,myfunction,这是第三方dll的一部分.

Att*_*ila 5

通过删除try/catch块,您不会捕获调用该函数时引发的异常.这会导致未捕获的异常一直到堆栈,main()并且由于它仍未处理,因此退出程序

从oputput看来,抛出的整数似乎是错误发生的代码.要查看是否可以协调,您需要查找错误代码.