Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怀疑某些 ASSERTION 代码有副作用。我想关闭 ASSERT 而不对我的代码的编译方式进行任何其他更改。我正在使用 MSVS2008。从调试切换到发布不会这样做,因为这会改变内存的初始化方式。
将其放在头文件的顶部cassert(或包含的包含cassert)之后
cassert
#undef assert #define assert(x) ((void)0)
这重新定义了 assert marco,使其扩展为空。
如果您的意思是assert,那么应该使用 NDEBUG 宏来控制。
assert