Try...Catch doesn't catch access violation exception?

VS2005 C++ and MFC.

Under certain abnormal conditions, my application causes an access violation (c0000005), and the program crashes. I have tried inserting

try {

} catch (...) {

}

around the offending code, but this doesn't catch this exception.

Is it possible for the try...catch mechanism to catch this kind of exception?

Thanks,

Jim

[393 byte] By [DrJim] at [2007-12-24]
# 1

By default C++ does not catch this type of exceptions (asynchronous). The following compiler switch (/EHa) should be what you need to make it work:

http://msdn2.microsoft.com/en-us/library/1deeycx5.aspx

MikeDanes at 2007-8-31 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 2

Mike,

That did it. Thanks for your quick response.

Jim

DrJim at 2007-8-31 > top of Msdn Tech,Visual C++,Visual C++ Language...