What does “#define assert(exp) ((void) 0)” do?
问题 I came across this preprocessor definition while reading the source code in Windows Research Kernel (WRK) 1.2: #define assert(exp) ((void) 0) What does this code do? Why is it defined? 回答1: It defines the expression assert( anything ) to do nothing. 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. 回答2: To expand on what bdonlan says, the reason the macro does not expand