C 语言编码规范 MissionGroupByZorru
2/ 42
目录
1 目的.......................................................................................................................................3
2 定义.......................................................................................................................................3
3 设计规范...............................................................................................................................3
3.1 函数设计规范................................................................................................................3
3.2 结构设计规范................................................................................................................5
4 编码规范...............................................................................................................................6
4.1 排版................................................................................................................................6
4.2 注释..............................................................................................................................11
4.3 标识符命名..................................................................................................................16
4.4 可读性..........................................................................................................................19
4.5 变量、结构..................................................................................................................20
4.6 宏..................................................................................................................................22
4.7 函数..............................................................................................................................23
4.7.1 总则.......................................................................................................................23
4.7.2 接口、参数...........................................................................................................28
4.7.3 条件、循环、分支语句.......................................................................................29
4.7.4 内存、指针...........................................................................................................33
4.7.5 返回值...................................................................................................................35
4.8 可维护性......................................................................................................................36
4.9 可测试性......................................................................................................................39
4.10 程序效率....................................................................................................................41
4.11 代码编辑、编译、审查............................................................................................41