Try {} catch (...) {} Used to use try {} catch (...) {} To catch some unexpected exceptions in C ++. Today I read winhack's post to know that this method is actually unreliable in VC. For example Code : Try {byte * PCH; PCH = (byte *) 00001234; // give an Invalid Address * PCH = 6; // assign a value to the Invalid Address, will cause access violation exception} catch (...) {afxmessagebox ("catched");} the code is normal in debug. The exception will be caught and a message box "catched" will pop up. However, if the compiler code optimization option is selected in the release mode, the VC compiler searches for the code in the try block. If the throw code is not found, he will think that the try catch structure is redundant and optimized. In the release mode, exceptions in the above Code cannot be captured, thus forcing Program The pop-up error prompt box exits. So can we catch this exception in the release code optimization status? The answer is yes. It is the _ Try, _ struct T structure. If the above Code is changed to the following code exception, it can be captured. _ Try {byte * PCH; PCH = (byte *) 00001234; // give an Invalid Address * PCH = 6; // assign a value to the Invalid Address, the access violation exception will occur.} _ response T (exception_execute_handler) {afxmessagebox ("catched");} but there is still a problem using the _ Try and _ Wait t blocks, this is not a C ++ standard, but a Windows platform-specific extension. In addition, if you call a local object destructor during use, the c2712 compilation error may occur. So there is no other way? Of course, it is still using the C ++ standard try {} catch (..) {}, but adding the/EHA parameter to the compile command line. In this way, the VC compiler will not optimize the try catch module. This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/startexcel/archive/2009/05/19/4201585.aspx