C++ Exception “Skips” Try-Catch Clause in MSVC x64

前端 未结 3 489
萌比男神i
萌比男神i 2020-12-30 04:28

I\'m writing a program in C++. The program has been working fine for Win32 (x86), and recently I\'ve tried compiling it natively for x64. Of course, stuff didn\'t work right

相关标签:
3条回答
  • 2020-12-30 04:38

    This bug may have something to do with compiler optimization -- it's interesting that the linker crashes in your release build (when full optimization would theoretically be turned on).

    Does your debug build have optimization completely disabled (/Od)?

    Visual Studio Help also contains a statement (under "Optimization Best Practices") discouraging try/catch blocks in 64-bit code.

    If you turn off optimization in the release build, the linker doesn't crash. It also won't crash (but will reproduce the bad behavior) if you remove just the "continue" statement.

    if (1==0) {
    //continue;
    }
    
    0 讨论(0)
  • 2020-12-30 04:47

    Try the switch /FAs switch:

    http://msdn.microsoft.com/en-us/library/367y26c6%28v=vs.80%29.ASPX

    somewhere in "additional output file" in your "compiler settings". ( make sure all other settings are the sames )

    Then, do a diff between both outputs. post the diff here. I'm sure some people will be able to tell you the why and how, and maybe some compiler settings or code workaround.

    0 讨论(0)
  • 2020-12-30 04:57

    this is an old known issue, after digging it out this is what we found out some time ago.

    http://social.msdn.microsoft.com/Forums/en-US/19eb8218-0dc4-4e4f-954f-4c4c3b3cd118/why-am-i-not-being-alerted-of-exceptions-from-methods-that-are-run-when-the-application-loads?forum=csharpide

    0 讨论(0)
提交回复
热议问题