《 Google C++ Style Guide》——谷歌C++编程风格指南 郑州大学 赵峻 (仅供参考) 谷歌C++编程风格指南 [版本:3.180] Benjy Weinberger Craig Silverstein Gregory Eitzmann Mark Mentovai Tashana Landray 翻译:郑州大学 赵峻 (仅供参考) 《 Google C++ Style Guide》——谷歌C++编程风格指南 郑州大学 赵峻 (仅供参考) 1 目录 一、 背景 ........................................................... 1 二、 正文 ........................................................... 1 1. 头文件(Header Files) ........................................ 1 1.1 #define保护(#include guard) .................................................................. 1 1.2 头文件的依赖关系(Header File Dependencies) .................................... 2 1.3 内联函数(Inline Functions) .................................................................... 2 1.4 内联头文件(The –inl.h Files) .............................................................. 3 1.5 函数参数次序(Function Parameter Ordering) ...................................... 3 1.6 包含的命名和次序(Names and Order of includes) .............................. 3 2. 作用域(Scoping) ............................................. 4 2.1 名称空间(Namespaces) ................................................................................ 4 2.2 类嵌套(Nested Classes) ............................................................................ 6 2.3 外部函数、静态成员函数和全局函数(Nonmember, Static Member, and Global Functions) ......................................................................................................... 7 2.4 局部变量(Local Variables) ...................................................................... 7 2.5 静态变量和全局变量(Static and Global Variables) .......................... 8 3. 类(Classes) ............................................... 9 3.1 在构造函数中完成工作(Doing Work in Constructors) ....................