本文介绍了&是什么QUOT;#定义断言(EXP)((无效)0)QUOT;做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我碰到这个preprocessor定义出来,而读<一个源$ C $ C href=\"http://www.microsoft.com/resources/sharedsource/windowsacademic/researchkernelkit.mspx\">Windows研究内核(WRK) 1.2:
I came across this preprocessor definition while reading the source code in Windows Research Kernel (WRK) 1.2:
#define assert(exp) ((void) 0)
这是什么code呢?为什么定义?
What does this code do? Why is it defined?
推荐答案
它定义了前pression断言(什么的)什么都不做。
It defines the expression assert(anything) to do nothing.
presumably,环境中使用不支持在ANSI C 语句,或者程序员不知道的事实,它可以通过定义NDEBUG被禁用。
Presumably, the environment being used does not support the ANSI C assert statement, or the programmer was unaware of the fact that it could be disabled by defining NDEBUG.
这篇关于&是什么QUOT;#定义断言(EXP)((无效)0)QUOT;做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!