分类分类
大小:441 KB更新:2026-08-31
类别:C/C++教程系统:PDF
Google C++ 编程规范目录
一、头文件.4
1. #define的保护.. 4
2. 头文件依赖..... 4
3. 内联函数 5
4. -inl.h文件..... 5
5. 函数参数顺序(Function Parameter Ordering)........5
6. 包含文件的名称及次序...6
二、作用域.7
1. 命名空间(Namespaces)7
2. 嵌套类(Nested Class)... 93. 非成员函数(Nonmember)、静态成员函数(Static Member)和全局函
数(Global Functions)9
4. 局部变量(Local Variables).10
5. 全局变量(Global Variables)....... 10
三、类.......11
1. 构造函数(Constructor)的职责......11
2. 默认构造函数(Default Constructors)....... 12
3. 明确的构造函数(Explicit Constructors)...12
4. 拷贝构造函数(Copy Constructors)....13
5. 结构体和类(Structs vs. Classes).......14
6. 继承(Inheritance)........14
7. 多重继承(Multiple Inheritance)....... 15
8. 接口(Interface).... 15
9. 操作符重载(Operator Overloading)16
10. 存取控制(Access Control)........16
11. 声明次序(Declaration Order).17
12. 编写短小函数(Write Short Functions)..17
四、Google特有的风情..... 18
1. 智能指针(Smart Pointers). 18
五、其他C++特性.....19
1. 引用参数(Reference Arguments)....19
2. 函数重载(Function Overloading).....19
3. 缺省参数(Default Arguments). 20
4. 变长数组和alloca(Variable-Length Arrays and alloca())....... 20
5. 友元(Friends)20
6. 异常(Exceptions).20
7. 运行时类型识别(Run-Time Type Information, RTTI) 22
8. 类型转换(Casting) 22
9. 流(Streams)..23
10. 前置自增和自减(Preincrement and Predecrement).24
11. const的使用(Use of const).....24
12. 整型(Integer Types)25
13. 64位下的可移植性(64-bit Portability).. 26
14. 预处理宏(Preprocessor Macros)...27
15. 0和NULL(0 and NULL)...27
16. sizeof(sizeof).....28
17. Boost库(Boost) 28
六、命名约定....29
1. 通用命名规则(General Naming Rules)....29
2. 文件命名(File Names). 30
3. 类型命名(Type Names)........31
4. 变量命名(Variable Names)31
5. 常量命名(Constant Names)....... 31
6. 函数命名(Function Names)........32
7. 命名空间(Namespace Names). 32
8. 枚举命名(Enumerator Names).32
9. 宏命名(Macro Names)33
10. 命名规则例外(Exceptions to Naming Rules)......33
七、注释...34
1. 注释风格(Comment Style).34
2. 文件注释(File Comments)..34
3. 类注释(Class Comments)..34
4. 函数注释(Function Comments)........ 35
5. 变量注释(Variable Comments)36
6. 实现注释(Implementation Comments) 37
7. 标点、拼写和语法(Punctuation, Spelling and Grammar). 38
8. TODO注释(TODO Comments).38
八、格式...39
1. 行长度(Line Length)....39
2. 非ASCII字符(Non-ASCII Characters)....40
3. 空格还是制表位(Spaces vs. Tabs)..... 40
4. 函数声明与定义(Function Declarations and Definitions).40
5. 函数调用(Function Calls)... 42
6. 条件语句(Conditionals).......43
7. 循环和开关选择语句(Loops and Switch Statements)..44
8. 指针和引用表达式(Pointers and Reference Expressions).45
9. 布尔表达式(Boolean Expressions).. 46
10. 函数返回值(Return Values)..... 46
11. 变量及数组初始化(Variable and Array Initialization)...... 46
12. 预处理指令(Preprocessor Directives). 46
13. 类格式(Class Format).......47
14. 初始化列表(Initializer Lists)...48
15. 命名空间格式化(Namespace Formatting)....48
16. 水平留白(Horizontal Whitespace)........ 49
17. 垂直留白(Vertical Whitespace)..... 50
九、规则之例外.52
1. 现有不统一代码(Existing Non-conformant Code)........52
2. Windows代码(Windows Code).......52
十、团队合作....53
百度网盘绿色免安装版其它工具366.81 MBv7.37.0.5官方版2026-08-31
下载C语言程序设计C/C++教程191 KB2026-07-06
下载捉虫历险记—常见C++Bug大围剿C/C++教程4.05 MB2026-07-06
下载gSOAP中文文档C/C++教程170 KB2026-07-06
下载谭浩强C语言教程 word完整版C/C++教程528 KB2026-07-06
下载C++ View书刊(共七期)C/C++教程3.86 MB2026-07-06
下载C++面试题(有答案)C/C++教程51 KB2026-07-06
下载嵌入式C/C++语言精华文章集锦C/C++教程1.5 MB2026-07-06
下载C语言教程讲义C/C++教程3.34 MB2026-07-06
下载数据结构-C语言(严蔚敏)包括习题集和答案C/C++教程7.19 MB2026-07-06
下载C语言深度概括C/C++教程730 KB2026-07-06
下载C语言直接操作FORTRAN数据文件的方法C/C++教程82 KB2026-07-06
下载人事档案管理系统-C语言C/C++教程162 KB2026-07-06
下载
