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

后端 未结 9 2374
清歌不尽
清歌不尽 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条回答
  •  旧巷少年郎
    2020-12-19 07:03

    You can not do that using standard C++ as it is not standard C++ exception. It's a structured exception. For the standard C++ exception somebody has to do a throw exception; from the code.

提交回复
热议问题