C 和 C++编程规范
作者: 日期:
审批: 日期:
目 录
1 引言....................................................................................................................................3
1.1 文档用途.....................................................................................................................................3
1.2 阅读对象.....................................................................................................................................3
1.3 参考资料.....................................................................................................................................3
2 变量命名规则.....................................................................................................................4
2.1 构成方式.....................................................................................................................................4
2.2 变量作用域.................................................................................................................................4
2.3 变量类型.....................................................................................................................................4
2.4 特别情况.....................................................................................................................................5
3 其他命名规则.....................................................................................................................6
3.1 函数和过程.................................................................................................................................6
3.2 Class(类).....................................................................................................................................6
3.3 Structure(结构)...........................................................................................................................6
3.4 Interface(Corba 接口).................................................................................................................6
3.5 常数.............................................................................................................................................6
3.6 全局标识符.................................................................................................................................7
4 注释....................................................................................................................................8
4.1 源程序头.....................................................................................................................................8
4.2 函数或过程.................................................................................................................................8
4.3 代码修改.....................................................................................................................................9
4.4 其他注释.....................................................................................................................................9
5 代码风格和版式约定.........................................................................................................11
5.1 一般约定...................................................................................................................................11
5.2 头文件.......................................................................................................................................12
5.3 类风格约定...............................................................................................................................13
6 关于跨平台和编译器的处理..............................................................................................15
6.1 系统配置头文件 compile.h......................................................................................................15
6.2 关于 int32 和 int64....................................................................................................................15
7 其他参考惯例...................................................................................................................16
2 / 16