How to spot undefined behavior

后端 未结 10 607
梦毁少年i
梦毁少年i 2021-01-11 11:45

Is there any way to know if you program has undefined behavior in C++ (or even C), short of memorizing the entire spec?

The reason I ask is that I\'ve noticed a lot

10条回答
  •  猫巷女王i
    2021-01-11 12:19

    A good compiler, such as the Intel C++ compiler, should be able to spot 99% of cases of undefined behaviour. You'll need to investigate the flags and switches to use. As ever, read the manual.

提交回复
热议问题