#if的使用

if 后面接的是表达式

#if a==1
code
……
#endif

如果#if后面的表达式能成立,就会把#if和#endif之间的代码编译进去

#if defined的使用

#if defined (x)
code
……

如果x这个宏又被定义过,则把#if和#endif之间的代码编译进去

注意点

  1. 两个都只是用来决定某段代码是否被编译
  2. 记得加#endif

#if、#if defined 的使用的更多相关文章

  1. No result defined for action com.lk.IndexAction and result success

    意图访问一个 /es/index.action 竟然出现: [SAE ] ERROR [05-11 13:54:32] [http-80-5] com.opensymphony.xwork2.util ...

  2. Apache报错信息之Invalid command 'Order', perhaps misspelled or defined by a module not included in the server config

    今天配置开启Apache虚拟主机时, 然后日志报错提示: Invalid command 'Order', perhaps misspelled or defined by a module not ...

  3. _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)

    原文地址::http://blog.csdn.net/xiaolongwang2010/article/details/7550505 相关网帖 1.错误找不到WinsdkVer.h----http: ...

  4. VC++ : error LNK2005: ... already defined in *.obj

    今天写代码遇到了这么一个链接错误:"已经在*.obj中定义". error LNK2005: "void __cdecl ReplaceWstringVar(class ...

  5. Target runtime com.genuitec.runtime.generic.jee60 is not defined

    转载自:http://jingyan.baidu.com/article/d7130635338e3f13fdf47518.html 用eclipse加载别人的工程,报错Target runtime ...

  6. TOMCAT-报错The BASEDIR environment variable is not defined correctly

    <span style="font-size:18px;">The BASEDIR environment variable is not defined correc ...

  7. MySql.Data.MySqlClient.MySqlException: Parameter ‘@maxid’ must be defined

    本文涉及到的mysql知识点: mysql中的if条件语句用法: IF(expr1,expr2,expr3) mysql使用变量(mysql中变量不用事前申明) mysql事务 testcase 为了 ...

  8. SQL SERVER中用户定义标量函数(scalar user defined function)的性能问题

    用户定义函数(UDF)分类  SQL SERVER中的用户定义函数(User Defined Functions 简称UDF)分为标量函数(Scalar-Valued Function)和表值函数(T ...

  9. no result defined for action

    1.no result defined for action .......and result input    或者 no result defined for action .......and ...

  10. 解决:Error: JAVA_HOME is not defined correctly

    问题重现: Error: JAVA_HOME is not defined correctly. We cannot execute :/usr/lib/jvm/java-7-oracle 问题分析: ...

随机推荐

  1. AutoHotkey的函数对象的Bind方法绑定参数的应用

    近期在写Excel数据批处理函数,想提取某列的每个数据是否匹配某某条件的所有单元格. 这种需求比较多,比如判断的值有:单元格值,字体颜色,单元格颜色等等, 判断条件有:相同,不同,正则,或在某多行字符 ...

  2. Windows 10 KMS 手工激活

    第一.安装好Win10系统,不需要安装其他激活工具.第二.是删除默认序列号,打开命令提示符(管理员),运行 slmgr.vbs -upk,可提示已卸载了序列号. slmgr /ipk W269N-WF ...

  3. 【深入理解JAVA虚拟机】第5部分.高效并发.1.Java内存模型与线程。

    1.概述 摩尔定律:描述处理器晶体管数量与运行效率之间的发展关系.Amdahl定律:通过系统中并行化与串行化的比重来描述多处理器系统能获得的运算加速能力. 从摩尔定律到Amdahl定律的转变,代表了近 ...

  4. February 13 2017 Week 7 Monday

    Don't trouble trouble until trouble troubles you. 不要自寻烦恼. It is the best way to live an easy life if ...

  5. angular中ngOnChanges与组件变化检测的关系

    1.ngOnChanges只有在输入值改变的时候才会触发,如果输入值(@Input)是一个对象,改变对象内的属性的话是不会触发ngOnChanges的. 2.组件的变化检测: 2a.changeDet ...

  6. 字符串拼接+和concat的区别

    +和concat都可以用来拼接字符串,但在使用上有什么区别呢,先来看看这个例子. public static void main(String[] args) { // example1 String ...

  7. django.db中的transaction

    transaction.set_autocommit(0) ..... ........ ................ transaction.commit() 可以使夹在其两句中间的所有SQL语 ...

  8. xalan\xalan\2.7.2\xercesImpl.jar (系统找不到指定的文件)问题

    本文转自:http://blog.csdn.net/lveliu/article/details/77772828 环境搭建为:maven+tomcat tomcat 8.5.2 以上会出现改问题(包 ...

  9. PHP 生成全局唯一id

    直接上代码: function generate_global_uniqid() { $prefix = md5(microtime(true)); // 生成唯一ID发生器 prefix,如果为服务 ...

  10. Poj2010 Moo University - Financial Aid

    题意的话,就看其他人的吧 概括:二分中位数 大体上便是二分一个中位数,带入检验,若分数比他小的有\(\lfloor n/2 \rfloor\)个,分数比他的大的也有这么多,而且贪心的买,花费小于预算. ...