What does msvc 6 throw when an integer divide by zero occurs?

前端 未结 4 825
陌清茗
陌清茗 2021-01-26 04:10

I have been doing a bit of experimenting, and have discovered that an exception is being thrown, when an integer divide by zero occurs.

#include 

        
4条回答
  •  故里飘歌
    2021-01-26 04:46

    The result is undefined, you could use __try / __except block to catch the error (structured exception handling). However, why not simply check for the error before your division?

提交回复
热议问题