How can I completely disable calls to assert()?

前端 未结 5 1946
别跟我提以往
别跟我提以往 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:33

    You must #define NDEBUG (or use the flag -DNDEBUG with g++) this will disable assert as long as it's defined before the inclusion of the assert header file.

提交回复
热议问题