软件编程规范-C/C++篇
目 录
目 录.......................................................................................................................................3
前 言.......................................................................................................................................4
1 基本原则.............................................................................................................................5
2 布 局....................................................................................................................................7
2.1 文件布局.....................................................................................................................7
2.2 基本格式.....................................................................................................................9
2.3 对齐.............................................................................................................................9
2.4 空行空格....................................................................................................................11
2.5 断行...........................................................................................................................13
3 注 释..................................................................................................................................14
4 命名规则...........................................................................................................................20
5 变量、常量与类型...........................................................................................................24
5.1 变量与常量...............................................................................................................24
5.2 类型...........................................................................................................................26
6 表达式与语句...................................................................................................................32
7 函数与过程.......................................................................................................................38
7.1 参数...........................................................................................................................38
7.2 返回值.......................................................................................................................39
7.3 内部实现...................................................................................................................39
7.4 函数调用...................................................................................................................42
8 可靠性...............................................................................................................................44
8.1 内存使用...................................................................................................................44
8.2 指针使用...................................................................................................................46
8.3 类和函数...................................................................................................................47
9 可测试性...........................................................................................................................53
10 断言与错误处理.............................................................................................................56
附 录.....................................................................................................................................61
.1 附录A 编程模版..........................................................................................................61
.2 附录B 规范检查表......................................................................................................67
参考文献..............................................................................................................................72
第 3 页 共 72 页