intermixing c++ exception handling and SEH (windows)

前端 未结 3 1116
不知归路
不知归路 2021-02-10 00:25

I have a function in which I call getaddrinfo() to get an sockaddr* which targets memory is allocated by the system. As many may know, you need to call

3条回答
  •  猫巷女王i
    2021-02-10 00:57

    You can't mix the two exception types. Under the covers, C++ exceptions use SEH and your SEH exception handler could mess up the exception propogation logic. As a result, the C++ compiler won't allow you to mix them.

    PS: Structured Exception Handling is almost always a VERY bad idea. Internally Microsoft has banned the use of SEH except in very limited circumstances. Any component that does use structured exception handling is automatically subject to intense code reviews (we have tools that scan code looking for its use to ensure that no cases are missed).

    The problem with SEH is that it's extremely easy to accidentally introduce security vulnerabilities when using SEH.

提交回复
热议问题