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;
        }
    }

  • 相关阅读:
    什么是ORM
    ORM优缺点
    Azure 中快速搭建 FTPS 服务
    连接到 Azure 上的 SQL Server 虚拟机(经典部署)
    在 Azure 虚拟机中配置 Always On 可用性组(经典)
    SQL Server 2014 虚拟机的自动备份 (Resource Manager)
    Azure 虚拟机上的 SQL Server 常见问题
    排查在 Azure 中新建 Windows 虚拟机时遇到的经典部署问题
    上传通用化 VHD 并使用它在 Azure 中创建新 VM
    排查在 Azure 中新建 Windows VM 时遇到的部署问题
  • 原文地址:https://www.cnblogs.com/ITBread/p/2248901.html
Copyright © 2011-2022 走看看