zoukankan      html  css  js  c++  java
  • 注释

    作用:用于对代码进行解释说明

    单行注释:

      \.........

    多行注释:

      *  ......

          ...... 

          ...... *

    嵌套注释:

           #if condition

          ...

            #endif

        #if 0
            cout << "branch1" << endl; //执行该语句
        #else
            cout << "branch2" << endl;
        #endif
    
    
        #if 1
            cout << "branch1" << endl;
        #else
            cout << "branch2" << endl;  //执行该语句
        #endif

      这种形式对程序调试也可以帮助,测试时使用 #if 1 来执行测试代码,发布后使用 #if 0 来屏蔽测试代码

      #if 后可以是任意的条件语句

      下面的代码如果 condition 条件为 true 执行 code1 ,否则执行 code2

      #if condition
        code1
      #else
        code2
      #endif
  • 相关阅读:
    C#深复制和浅复制
    C#程序设计六大原则记录
    C#异步
    线程同步
    线程基础
    委托,事件
    XmlSerializer
    C#接口
    C#封装
    C#多态
  • 原文地址:https://www.cnblogs.com/shiliye/p/13746458.html
Copyright © 2011-2022 走看看