How can I completely disable calls to assert()?

前端 未结 5 1933
别跟我提以往
别跟我提以往 2020-11-28 08:02

My code is full of calls to assert(condition). In the debug version I use g++ -g which triggers my assertions. Unexpectedly, the same assertions ar

5条回答
  •  醉梦人生
    2020-11-28 08:35

    The -g flag doesn't affect the operation of assert, it just ensures that various debugging symbols are available.

    Setting NDEBUG is the standard (as in official, ISO standard) way of disabling assertions.

提交回复
热议问题