#if 1......

   今天在看程序时,发现一个函数中使用的很多的 

#if 1

......

#endif

#if 0

......

#endif

因为没有用过,感到有点莫名。如是上网查找答案。终于明白是用来注释编译内容的。意思是说:

#if 1    需要编译器编译以下内容;

#if 0   编译器不要编译以下内容;

#if 0   #endif   这种用法还可以实现“注释嵌套!!!”

例如:

#include <iostream>
#include <tchar.h>
#include <stdlib.h>
using namespace std;

int _tmain(int, char **,char **)
{
#if 1
 int a=0;
#endif
#if 0
 int b=0;
#endif
#if 1
 int c=0;
#endif
 cout<<a<<b<<c<<endl;
 return 0;
}

 是编译不通过的

原文地址:https://www.cnblogs.com/zhiweiyouzhishenghuo/p/5005531.html