c:#ifndef, #define, #endif 作用

#ifndef, #define, #endif 作用

#ifndef

  它是if not define 的简写,是宏定义的一种,实际上确切的说,这应该是预处理功能三种(宏定义、文件包含、条件编译)中的一种----条件编译。

    在sqlite源代码中大量使用了条件编译。如下:

#ifndef MIN
# define MIN(A,B) ((A)<(B)?(A):(B))
#endif
#ifndef MAX
# define MAX(A,B) ((A)>(B)?(A):(B))
#endif

 

上一篇:c++模板文件,方便调试与运行时间的观察


下一篇:判断是否包含某个头文件