How to catch divide-by-zero error in Visual Studio 2008 C++?

后端 未结 9 2370
清歌不尽
清歌不尽 2020-12-19 06:26

How can I catch a divide-by-zero error (and not other errors; and to be able to access exception information) in Visual Studio 2008 C++?

I tried this:



        
9条回答
  •  Happy的楠姐
    2020-12-19 07:11

    A good approach would be to use safe object oriented wrappers like SafeInt. It also seems to be integrated in Visual Studio 2010.

    update:
    If the division-by-zero happens in third party code your only option is SEH or something equivalent as answered by Seb Rose

提交回复
热议问题