I use VS2010 and C++ in release config
The following executed okay:
int status;
try
{
status = myfunction(arg1, arg2);
}
catch (int e)
{
cout << "An exception occurred. Exception Nr. " << e << endl;
}
However, the following crashed the program:
int status;
status = myfunction(arg1, arg2);
What happened?
I do not have the source of the method, myfunction, which is part of a third party dll.
By removing the try/catch block, you do not catch an exception that is thrown when the function is called. This causes the uncaught exception to wind up the stack all the way to
main()and since it is still unhandled, exit the programFrom the oputput it seems the thrown integer is a code for what error happened exactly. To see if this can be reconciled, you need to look up the error code.