If I understand you correctly then yes.
If an exception occurs in
ProcessStuff()and the exception handler in that function does not handle
the exception, that exception will propagate up the
stack until a handler for the exception is found.
In your example the
catch(...) is set to
catch and handle any exception that
ProcessSuff() does not.
However, the c++ exception handler does not catch certain types of
exception. In your original post you stated you were getting a memory
access violation. The standard c++ exception mechanism does not catch these types of exceptions, nor things like divide by zero.
Here is an example
CODE
void Process()
{
int *pInt = (int*)0x00000000;
// Try and access the memory
*pInt = 44;
}
int main(int argc, char *argv[])
{
// SEH
// This will be caught
__try
{
Process();
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
std::cout << "caught exception with SEH handler\n";
}
// C++ exception handling
// The exception generated by Process()
// will not be handled
try
{
Process();
}
catch(...)
{
std::cout << "caught exception with c++ exception handler\n";
}
}
Note: The code above above won't compile correctly
MSVC++ only allows 1 type of exception handling per
function. So just comment out 1 set of try/catch to test and you
will see that the __try/__except handles memory
access violations but the try/catch does not. It will
display the message box you were talking about
in your 1st post.
This post has been edited by skaoth: 13 Mar, 2008 - 11:18 AM