Project MetroWave General
Section SW Engineering
File Name 嵌入式软件编程规范
Document Number:
SW-00-00-0004
Revision: 0.9
Date: 2005-1-3
Copyright @2005 Photonic Bridges Inc. (Company Confidential) Page 2 of 46
根据 12-28 QA Team Review 整
理,从“编程参考”中分离出一篇
较为简短的“编程规范”。
将内部讨论得到的一篇短文《代码
质量定义》加入成为第 10 章。
根据 2005-1-12 的 QA 扩大会议的
建议进行整理,增加了附录 B。
1 文档概述 ............................................................................................................................................................................3
1.1 关于本文档 ................................................................................................................................................................3
1.2 参考文献 ....................................................................................................................................................................3
2 排版 ....................................................................................................................................................................................4
3 注释 ....................................................................................................................................................................................9
4 标识符命名 ......................................................................................................................................................................17
5 可读性 ..............................................................................................................................................................................23
6 变量、结构 ......................................................................................................................................................................24
7 宏 ......................................................................................................................................................................................29
8 函数、过程 ......................................................................................................................................................................31
9 可测性 ..............................................................................................................................................................................38
10 代码版本管理 ..............................................................................................................................................................41
10.1 代码质量定义 ......................................................................................................................................................41
10.2 CVS 分支定义 .........................................................................................................................................................41
10.3 CVS 代码引入规定 .................................................................................................................................................41
10.4 CVS 代码 COMMIT 顺序 ..........................................................................................................................................42
10.5 COMMIT 文件过程中的其他注意事项....................................................................................................................42
11 附录 A – 推荐编辑器的默认配置修改 ......................................................................................................................43
11.1 UNTRAEDIT 默认配置修改 ......................................................................................................................................43
11.2 SOURCE-INSIGHT 默认配置修改 ..............................................................................................................................44
12 附录 B– PC-LINT 的使用简介 ..................................................................................................................................45
12.1 PC-LINT 的软件包说明..........................................................................................................................................45
12.2 PC-LINT 的使用步骤..............................................................................................................................................45
12.3 PC-LINT 的使用规则(BY FUJILI) ...........................................................................................................................46