MSVC - /EHsc vs /EHa (synchronous vs asynchronous exception handling)

后端 未结 2 1459
隐瞒了意图╮
隐瞒了意图╮ 2020-12-29 23:52

Could you give a bullet list of practical differences/implication? I read relevant MSDN article, but my understanding asynchronous exceptions is still a bit hazy.

I

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 00:20

    Well, without /EHa you can't catch unexpected exceptions so your test program will exit abnormally.

    If the test can be made for abnormal exit it'd be better not wrestle with /EHa.

    Moreover, changing option to /EHa incur many side effects including increase in executable size and little performance drop. So effectively changes original behavior.

    To use or not to use /EHa is a big decision usually made at program design stage.

    IMHO, problems at test case writing are rather insignificant to change this decision.

提交回复
热议问题