zoukankan      html  css  js  c++  java
  • 审查表自取

    C/C++代码审查表

    markdown里面的表格语法是没法实现合并行列的,但是我们需要这种效果,其实markdown最后解析转化成HTMl所以我们直接写HTML不就好了,再想想其实老师给了审查表的网址,直接F12复制下来不就好了,以下提供了我复制下来并格式化了的的HTML,只需要复制粘贴,放入你的博文里,然后按照要求填表就行了,(空标签就是要填的位置)

    <table>
      <tbody>
        <tr>
          <td class="xl66" width="110" height="19">功能模块名称</td>
          <td class="xl83" colspan="3" width="964"> </td>
        </tr>
        <tr>
          <td class="xl67" width="110" height="19">审查人</td>
          <td class="xl72" width="620"> </td>
          <td class="xl68" width="82">审查日期</td>
          <td class="xl69"> </td>
        </tr>
        <tr>
          <td class="xl67" width="110" height="19">代码名称</td>
          <td class="xl72" width="620"> </td>
          <td class="xl68" width="82">代码作者</td>
          <td class="xl69"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">文件结构</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;</td>
          <td class="xl72" width="620">头文件和定义文件的名称是否合理?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl73" width="620">头文件和定义文件的目录结构是否合理?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl73" width="620">版权和版本声明是否完整?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">头文件是否使用了 ifndef/define/endif 预处理块?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">头文件中是否只存放“声明”而不存放“定义”</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">程序的版式</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">空行是否得体?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">代码行内的空格是否得体?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">长行拆分是否得体?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">“{” 和 “}” 是否各占一行并且对齐于同一列?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">一行代码是否只做一件事?如只定义一个变量,只写一条语句。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">If、for、while、do等语句自占一行,不论执行语句多少都要加 “{}”。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="38">重要</td>
          <td class="xl72" width="620">在定义变量(或参数)时,是否将修饰符 * 和 & 紧靠变量名?注释是否清晰并且必要?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">注释是否有错误或者可能导致误解?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">类结构的public, protected, private顺序是否在所有的程序中保持一致?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">命名规则&nbsp;</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">命名规则是否与所采用的操作系统或开发工具的风格保持一致?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">标识符是否直观且可以拼读?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">标识符的长度应当符合“min-length &amp;&amp; max-information”原则?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">程序中是否出现相同的局部变量和全部变量?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">类名、函数名、变量和参数、常量的书写格式是否遵循一定的规则?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">静态变量、全局变量、类的成员变量是否加前缀?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">表达式与基本语句&nbsp;</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">如果代码行中的运算符比较多,是否已经用括号清楚地确定表达式的操作顺序?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">是否编写太复杂或者多用途的复合表达式?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否将复合表达式与“真正的数学表达式”混淆?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否用隐含错误的方式写if语句? 例如</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)将布尔变量直接与TRUE、FALSE或者1、0进行比较。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)将浮点变量用“==”或“!=”与任何数字比较。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)将指针变量用“==”或“!=”与NULL比较。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">如果循环体内存在逻辑判断,并且循环次数很大,是否已经将逻辑判</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">断移到循环体的外面?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">Case语句的结尾是否忘了加break?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否忘记写switch的default分支?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="38">重要</td>
          <td class="xl72" width="620">使用goto 语句时是否留下隐患? 例如跳过了某些对象的构造、变量的初始化、重要的计算等。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">常量&nbsp;</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">是否使用含义直观的常量来表示那些将在程序中多次出现的数字或字符串?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">在C++ 程序中,是否用const常量取代宏常量?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">如果某一常量与其它常量密切相关,是否在定义中包含了这种关系?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">是否误解了类中的const数据成员?因为const数据成员只在某个对象</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">生存期内是常量,而对于整个类而言却是可变的。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">函数设计&nbsp;</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">参数的书写是否完整?不要贪图省事只写参数的类型而省略参数名字。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">参数命名、顺序是否合理?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">参数的个数是否太多?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">是否使用类型和数目不确定的参数?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">是否省略了函数返回值的类型?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">函数名字与返回值类型在语义上是否冲突?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="38">重要</td>
          <td class="xl72" width="620">是否将正常值和错误标志混在一起返回?正常值应当用输出参数获得,而错误标志用return语句返回。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">在函数体的“入口处”,是否用assert对参数的有效性进行检查?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="38">重要</td>
          <td class="xl72" width="620">使用滥用了assert? 例如混淆非法情况与错误情况,后者是必然存在的并且是一定要作出处理的。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">return语句是否返回指向“栈内存”的“指针”或者“引用”?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="38"> </td>
          <td class="xl72" width="620">是否使用const提高函数的健壮性?const可以强制保护函数的参数、返回值,甚至函数的定义体。“Use const whenever you need”</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">内存管理&nbsp;</td>
        </tr>
        <tr>
          <td class="xl79" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl80" height="38">重要</td>
          <td class="xl72" width="620">用malloc或new申请内存之后,是否立即检查指针值是否为NULL?(防止使用指针值为NULL的内存)</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="19">重要</td>
          <td class="xl72" width="620">是否忘记为数组和动态内存赋初值?(防止将未被初始化的内存作为右值使用)</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="19">重要</td>
          <td class="xl72" width="620">数组或指针的下标是否越界?</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="19">重要</td>
          <td class="xl72" width="620">动态内存的申请与释放是否配对?(防止内存泄漏)</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="19">重要</td>
          <td class="xl72" width="620">是否有效地处理了“内存耗尽”问题?</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="19">重要</td>
          <td class="xl72" width="620">是否修改“指向常量的指针”的内容?</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="38">重要</td>
          <td class="xl72" width="620">是否出现野指针?例如(1)指针变量没有被初始化;(2)用free或delete释放了内存之后,忘记将指针设置为NULL。</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="19">重要</td>
          <td class="xl72" width="620">是否将malloc/free 和 new/delete 混淆使用?</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="19">重要</td>
          <td class="xl72" width="620">malloc语句是否正确无误?例如字节数是否正确?类型转换是否正 确?</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl80" height="19">重要</td>
          <td class="xl72" width="620">在创建与释放动态对象数组时,new/delete的语句是否正确无误?</td>
          <td class="xl92" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">C++ 函数的高级特性&nbsp;</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">重载函数是否有二义性?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否混淆了成员函数的重载、覆盖与隐藏?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">运算符的重载是否符合制定的编程规范?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">是否滥用内联函数?例如函数体内的代码比较长,函数体内出现循环。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否用内联函数取代了宏代码?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">类的构造函数、析构函数和赋值函数</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否违背编程规范而让C++ 编译器自动为类产生四个缺省的函数:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)缺省的无参数构造函数;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)缺省的拷贝构造函数;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)缺省的析构函数;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(4)缺省的赋值函数。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">构造函数中是否遗漏了某些初始化工作?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否正确地使用构造函数的初始化表?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">析构函数中是否遗漏了某些清除工作?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">是否错写、错用了拷贝构造函数和赋值函数?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">赋值函数一般分四个步骤:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)检查自赋值;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)释放原有内存资源;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)分配新的内存资源,并复制内容;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(4)返回 *this。是否遗漏了重要步骤?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否正确地编写了派生类的构造函数、析构函数、赋值函数?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">注意事项:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)派生类不可能继承基类的构造函数、析构函数、赋值函数。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)派生类的构造函数应在其初始化表里调用基类的构造函数。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)基类与派生类的析构函数应该为虚(即加virtual关键字)。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(4)在编写派生类的赋值函数时,注意不要忘记对基类的数据成员重新赋值</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">类的高级特性</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">是否违背了继承和组合的规则?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="38"> </td>
          <td class="xl72" width="620">(1)若在逻辑上B是A的“一种”,并且A的所有功能和属性对B而言都有意义,则允许B继承A的功能和属性。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="38"> </td>
          <td class="xl72" width="620">(2)若在逻辑上A是B的“一部分”(a part of),则不允许B从A派生,而是要用A和其它东西组合出B。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl74" height="19"> </td>
          <td class="xl72" width="620"> </td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl86" colspan="4" height="19">其它常见问题&nbsp;</td>
        </tr>
        <tr>
          <td class="xl70" height="19">重要性&nbsp; &nbsp; &nbsp;&nbsp;</td>
          <td class="xl77" width="620">审查项</td>
          <td class="xl89" colspan="2">结论</td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">数据类型问题:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)变量的数据类型有错误吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)存在不同数据类型的赋值吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)存在不同数据类型的比较吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">变量值问题:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)变量的初始化或缺省值有错误吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)变量发生上溢或下溢吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)变量的精度够吗?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">逻辑判断问题:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)由于精度原因导致比较无效吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)表达式中的优先级有误吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)逻辑判断结果颠倒吗?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">循环问题:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)循环终止条件不正确吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)无法正常终止(死循环)吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)错误地修改循环变量吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(4)存在误差累积吗?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">错误处理问题:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)忘记进行错误处理吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)错误处理程序块一直没有机会被运行?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="38"> </td>
          <td class="xl72" width="620">(3)错误处理程序块本身就有毛病吗?如报告的错误与实际错误不一致,处理方式不正确等等。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(4)错误处理程序块是“马后炮”吗?如在被它被调用之前软件已经出错。</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19">重要</td>
          <td class="xl72" width="620">文件I/O问题:</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(1)对不存在的或者错误的文件进行操作吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(2)文件以不正确的方式打开吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(3)文件结束判断不正确吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl71" height="19"> </td>
          <td class="xl72" width="620">(4)没有正确地关闭文件吗?</td>
          <td class="xl81" colspan="2"> </td>
        </tr>
        <tr>
          <td class="xl75" height="20"> </td>
          <td class="xl78" width="620"> </td>
          <td class="xl95" colspan="2"> </td>
        </tr>
      </tbody>
    </table>
    

    效果

    功能模块名称  
    审查人   审查日期  
    代码名称   代码作者  
    文件结构
    重要性       审查项 结论
                     头文件和定义文件的名称是否合理?  
      头文件和定义文件的目录结构是否合理?  
      版权和版本声明是否完整?  
    重要 头文件是否使用了 ifndef/define/endif 预处理块?  
      头文件中是否只存放“声明”而不存放“定义”  
         
    程序的版式
    重要性       审查项 结论
      空行是否得体?  
      代码行内的空格是否得体?  
      长行拆分是否得体?  
      “{” 和 “}” 是否各占一行并且对齐于同一列?  
    重要 一行代码是否只做一件事?如只定义一个变量,只写一条语句。  
    重要 If、for、while、do等语句自占一行,不论执行语句多少都要加 “{}”。  
    重要 在定义变量(或参数)时,是否将修饰符 * 和 & 紧靠变量名?注释是否清晰并且必要?  
    重要 注释是否有错误或者可能导致误解?  
    重要 类结构的public, protected, private顺序是否在所有的程序中保持一致?  
         
    命名规则 
    重要性       审查项 结论
    重要 命名规则是否与所采用的操作系统或开发工具的风格保持一致?  
      标识符是否直观且可以拼读?  
      标识符的长度应当符合“min-length && max-information”原则?  
    重要 程序中是否出现相同的局部变量和全部变量?  
      类名、函数名、变量和参数、常量的书写格式是否遵循一定的规则?  
      静态变量、全局变量、类的成员变量是否加前缀?  
         
    表达式与基本语句 
    重要性       审查项 结论
    重要 如果代码行中的运算符比较多,是否已经用括号清楚地确定表达式的操作顺序?  
      是否编写太复杂或者多用途的复合表达式?  
    重要 是否将复合表达式与“真正的数学表达式”混淆?  
    重要 是否用隐含错误的方式写if语句? 例如  
      (1)将布尔变量直接与TRUE、FALSE或者1、0进行比较。  
      (2)将浮点变量用“==”或“!=”与任何数字比较。  
      (3)将指针变量用“==”或“!=”与NULL比较。  
      如果循环体内存在逻辑判断,并且循环次数很大,是否已经将逻辑判  
      断移到循环体的外面?  
    重要 Case语句的结尾是否忘了加break?  
    重要 是否忘记写switch的default分支?  
    重要 使用goto 语句时是否留下隐患? 例如跳过了某些对象的构造、变量的初始化、重要的计算等。  
         
    常量 
    重要性       审查项 结论
      是否使用含义直观的常量来表示那些将在程序中多次出现的数字或字符串?  
      在C++ 程序中,是否用const常量取代宏常量?  
    重要 如果某一常量与其它常量密切相关,是否在定义中包含了这种关系?  
      是否误解了类中的const数据成员?因为const数据成员只在某个对象  
      生存期内是常量,而对于整个类而言却是可变的。  
         
    函数设计 
    重要性       审查项 结论
      参数的书写是否完整?不要贪图省事只写参数的类型而省略参数名字。  
      参数命名、顺序是否合理?  
      参数的个数是否太多?  
      是否使用类型和数目不确定的参数?  
      是否省略了函数返回值的类型?  
      函数名字与返回值类型在语义上是否冲突?  
    重要 是否将正常值和错误标志混在一起返回?正常值应当用输出参数获得,而错误标志用return语句返回。  
    重要 在函数体的“入口处”,是否用assert对参数的有效性进行检查?  
    重要 使用滥用了assert? 例如混淆非法情况与错误情况,后者是必然存在的并且是一定要作出处理的。  
    重要 return语句是否返回指向“栈内存”的“指针”或者“引用”?  
      是否使用const提高函数的健壮性?const可以强制保护函数的参数、返回值,甚至函数的定义体。“Use const whenever you need”  
         
    内存管理 
    重要性       审查项 结论
    重要 用malloc或new申请内存之后,是否立即检查指针值是否为NULL?(防止使用指针值为NULL的内存)  
    重要 是否忘记为数组和动态内存赋初值?(防止将未被初始化的内存作为右值使用)  
    重要 数组或指针的下标是否越界?  
    重要 动态内存的申请与释放是否配对?(防止内存泄漏)  
    重要 是否有效地处理了“内存耗尽”问题?  
    重要 是否修改“指向常量的指针”的内容?  
    重要 是否出现野指针?例如(1)指针变量没有被初始化;(2)用free或delete释放了内存之后,忘记将指针设置为NULL。  
    重要 是否将malloc/free 和 new/delete 混淆使用?  
    重要 malloc语句是否正确无误?例如字节数是否正确?类型转换是否正 确?  
    重要 在创建与释放动态对象数组时,new/delete的语句是否正确无误?  
         
    C++ 函数的高级特性 
    重要性       审查项 结论
      重载函数是否有二义性?  
    重要 是否混淆了成员函数的重载、覆盖与隐藏?  
      运算符的重载是否符合制定的编程规范?  
      是否滥用内联函数?例如函数体内的代码比较长,函数体内出现循环。  
    重要 是否用内联函数取代了宏代码?  
         
    类的构造函数、析构函数和赋值函数
    重要性       审查项 结论
    重要 是否违背编程规范而让C++ 编译器自动为类产生四个缺省的函数:  
      (1)缺省的无参数构造函数;  
      (2)缺省的拷贝构造函数;  
      (3)缺省的析构函数;  
      (4)缺省的赋值函数。  
    重要 构造函数中是否遗漏了某些初始化工作?  
    重要 是否正确地使用构造函数的初始化表?  
    重要 析构函数中是否遗漏了某些清除工作?  
      是否错写、错用了拷贝构造函数和赋值函数?  
    重要 赋值函数一般分四个步骤:  
      (1)检查自赋值;  
      (2)释放原有内存资源;  
      (3)分配新的内存资源,并复制内容;  
      (4)返回 *this。是否遗漏了重要步骤?          
    重要 是否正确地编写了派生类的构造函数、析构函数、赋值函数?  
      注意事项:  
      (1)派生类不可能继承基类的构造函数、析构函数、赋值函数。  
      (2)派生类的构造函数应在其初始化表里调用基类的构造函数。  
      (3)基类与派生类的析构函数应该为虚(即加virtual关键字)。  
      (4)在编写派生类的赋值函数时,注意不要忘记对基类的数据成员重新赋值  
         
    类的高级特性
    重要性       审查项 结论
    重要 是否违背了继承和组合的规则?  
      (1)若在逻辑上B是A的“一种”,并且A的所有功能和属性对B而言都有意义,则允许B继承A的功能和属性。  
      (2)若在逻辑上A是B的“一部分”(a part of),则不允许B从A派生,而是要用A和其它东西组合出B。  
         
    其它常见问题 
    重要性       审查项 结论
    重要 数据类型问题:  
      (1)变量的数据类型有错误吗?  
      (2)存在不同数据类型的赋值吗?  
      (3)存在不同数据类型的比较吗?  
    重要 变量值问题:  
      (1)变量的初始化或缺省值有错误吗?  
      (2)变量发生上溢或下溢吗?  
      (3)变量的精度够吗?          
    重要 逻辑判断问题:  
      (1)由于精度原因导致比较无效吗?  
      (2)表达式中的优先级有误吗?  
      (3)逻辑判断结果颠倒吗?          
    重要 循环问题:  
      (1)循环终止条件不正确吗?  
      (2)无法正常终止(死循环)吗?  
      (3)错误地修改循环变量吗?  
      (4)存在误差累积吗?          
    重要 错误处理问题:  
      (1)忘记进行错误处理吗?  
      (2)错误处理程序块一直没有机会被运行?  
      (3)错误处理程序块本身就有毛病吗?如报告的错误与实际错误不一致,处理方式不正确等等。  
      (4)错误处理程序块是“马后炮”吗?如在被它被调用之前软件已经出错。  
    重要 文件I/O问题:  
      (1)对不存在的或者错误的文件进行操作吗?  
      (2)文件以不正确的方式打开吗?  
      (3)文件结束判断不正确吗?  
      (4)没有正确地关闭文件吗?  
         
  • 相关阅读:
    LinuxMCE
    qBittorrent 0.9.0
    Exaile 0.2.9
    GAdminHttpd:图形化的 Apache 打点对象
    FBReader-电子书阅读对象
    CSSED:Linux 下 Web 拓荒者的 CSS 编纂利器
    Canorus:乐谱编辑软件
    AutoScan-收集监视及办理器械
    Lunar Applet:在桌面表现阴历
    Totem 2.18.1
  • 原文地址:https://www.cnblogs.com/ljsh/p/10753210.html
Copyright © 2011-2022 走看看