Is assert(false) ignored in release mode?

后端 未结 6 1828
耶瑟儿~
耶瑟儿~ 2020-12-15 04:12

I am using VC++. Is assert(false) ignored in release mode?

6条回答
  •  一向
    一向 (楼主)
    2020-12-15 04:51

    I think it is a mistake to rely too much on the exact behavior of the assert. The correct semantics of "assert(expr)" are:

    • The expression expr may or may not be evaluated.
    • If expr is true, execution continues normally.
    • If expr is false, what happens is undefined.

    More at http://nedbatchelder.com/text/assert.html

提交回复
热议问题