• C++ 代码规范 cppcheck 样式修改


    /*
     * style
     */
        1.Using C-style cast.  Use reinterpret_cast(...) instead  [readability/casting]

            const_cast(BT_VER)
            reinterpret_cast(BT_VER)

        2.Do not use namespace using-directives.  Use using-declarations instead.
          (不要使用命名空间using指令。请改用using声明)
            使用 using std::thread 替代 using namespace std;

        3.Should have a space between // and comment  [whitespace/comments] [4]
            注释后面加一个空格

        4. { should almost always be at the end of the previous line
            把函数的括号移到函数参数 ) 后面,即不要换行;
        
        5.Redundant blank line at the start of a code block should be deleted.
          (应删除代码块开头的多余空行)
            空函数{}之间不能有空行

        6.Line ends in whitespace.
            删除结尾空格

        7.Missing space before ( in for(
            for需有一个空格

        8.Missing spaces around =  [whitespace/operators]
            等号两边有空格

        9.Weird number of spaces at line-start.  Are you using a 2-space indent?
            行起始处有空格
        
        10.At least two spaces is best between code and comments
            注释前最少有两个空格

        11.Missing space after ,  [whitespace/comma] [3]
            参数之间要有空格

        12.If/else bodies with multiple statements require braces
            具有多个语句的If/else实体需要大括号

        13.Extra space before )
            ) 前后有空格

        14.Missing space before ( in if(
            if需有一个空格

  • 相关阅读:
    Flutter:文件与网络操作摘要
    并发编程之线程池
    Spring去除了RestTemplate的默认导入配置
    Linux 系统安全及应用
    notepad++ 设置文件名标签在左边
    MyBatis笔记——参数处理
    基于SSM+Vue的校园共享单车管理系统
    Nginx 负载均衡
    基于Docker容器DevOps应用方案
    区块链baas平台告警方案
  • 原文地址:https://blog.csdn.net/xiaozhiwise/article/details/132909836