Try…Catch doesn’t catch access violation exception?-ZZ

    From: xuyibo.org  Date: 2020-10-24 02:11 PM

    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


    Replay: 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:

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

    From: https://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/1d4563ea-64b2-4878-aa48-e9a0040b5aa9/

    EMail: * 如果为有效的邮箱地址,将自动发送站长回复