zoukankan      html  css  js  c++  java
  • 转载10种代码风格

    1.  Ansi/Allman/Bsd风格(格式缩进从下一行开始括号)
    int Foo(bool isBar)
    {
        if (isBar)
        {
            bar();
            return 1;
        }
        else
            return 0;

    2.  Java风格(格式缩进直接紧接后面括号)
    int Foo(bool isBar) {
        if (isBar) {
            bar();
            return 1;
        } else
            return 0;
    }

    3.  Kernighan_Ritchie风格(格式缩进使用Linux 方式括号)
    int Foo(bool isBar) 
    {
        if (isBar) {
            bar();
            return 1;
        } else
            return 0;
    }

    4.  Stroustrup风格(格式缩进使用stroustrup 方式括号,缩进使用5 个空格)
    int Foo(bool isBar) 
    {
         if (isBar) {
              bar();
              return 1;
         } else
              return 0;
    }

    5.  Whitesmith风格(格式缩进使用下一行且缩进的括号)
    int Foo(bool isBar) 
        {
        if (isBar)
            {
            bar();
            return 1;
            }
        else
            return 0;
        }
     
    6.  Banner 风格(格式缩进使用直接紧接和缩进的括号)
    int Foo(bool isBar) {
        if (isBar) {
            bar();
            return 1;
            }
        else
            return 0;
        }

    7.  GNU 风格(格式缩进使用下一行括号,语句块括号缩进两个空格)
    int Foo(bool isBar)
    {
      if (isBar)
        {
          bar();
          return 1;
        }
      else
        return 0;
    }

    8.  Linux 风格(格式缩进使用  Linux 方式括号,语句块里面缩进8 个空格)
    int Foo(bool isBar)
    {
            if (isFoo) {
                    bar();
                    return 1;
            } else
                    return 0;
    }

    9.  Horstmann风格(格式缩进使用horstman方式,括号紧接语句块)
    int Foo(bool isBar)
    {  if (isBar)
       {  bar();
          return 1;
       } else
          return 0;
    }
     
    10.  1tbs/otbs风格(格式缩进使用Linux 方式括号,自动补全单行语句块括号)
    int Foo(bool isBar)
    {
        if (isFoo) {
            bar();
            return 1;
        } else {
            return 0;
        }
    }

  • 相关阅读:
    ionic中关于ionicView 的生命周期
    ES6新特性之 promise
    使用angular中ng-repeat , track by的用处
    关于前端性能优化的思考
    浅谈JavaScript之原型
    浅谈JavaScript的New关键字
    JavaScript中闭包之浅析解读
    python3 linux下安装
    mycat高可用方案
    mysql高可用方案
  • 原文地址:https://www.cnblogs.com/ITBread/p/2248901.html
Copyright © 2011-2022 走看看