2024年4月11日发(作者:)
《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.2
1.3
1.4
1.5
1.6
2.
2.1
2.2
背景 ........................................................... 1
正文 ........................................................... 1
头文件(Header Files) ........................................ 1
1.1 #define保护(#include guard) .................................................................. 1
头文件的依赖关系(Header File Dependencies) .................................... 2
内联函数(Inline Functions) .................................................................... 2
内联头文件(The –inl.h Files) .............................................................. 3
函数参数次序(Function Parameter Ordering) ...................................... 3
包含的命名和次序(Names and Order of includes) .............................. 3
作用域(Scoping) ............................................. 4
名称空间(Namespaces) ................................................................................ 4
类嵌套(Nested Classes) ............................................................................ 6
2.3 外部函数、静态成员函数和全局函数(Nonmember, Static Member, and
Global Functions) ......................................................................................................... 7
2.4
2.5
3.
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
3.11
3.12
4.
4.1
5.
5.1
5.2
5.3
5.4
局部变量(Local Variables) ...................................................................... 7
静态变量和全局变量(Static and Global Variables) .......................... 8
类(Classes) ............................................... 9
在构造函数中完成工作(Doing Work in Constructors) ........................ 9
默认构造函数(Default Constructor) ...................................................... 9
显式构造函数(Explicit Constructors) ................................................ 10
复制构造函数(Copy Constructos) .......................................................... 10
结构体与类(Structs vs Classes) .......................................................... 11
继承(Inheritance) .................................................................................... 11
多重继承(Multiple Inheritance) .......................................................... 12
接口(Interface) ........................................................................................ 12
运算符重载(Operator Overloading) ...................................................... 13
访问控制(Access Control) .................................................................... 13
声明次序(Declaration Order) .............................................................. 13
定义简短函数(Write Short Functions) .............................................. 14
智能指针(Smart Pointers) .................................................................. 14
其他C++特性(Other C++ Fetures) ............................ 15
引用参数(Reference Arguments) ........................................................ 15
函数重载(Function Overloading) .......................................................... 15
默认参数(Default Arguments) ................................................................ 16
可变长度数组和内存申请(Variable-Length Arrays and alloca()) 16
1
谷歌经验技巧(Google-Specific Magic) ...................... 14
4.2 CPPlint ......................................................................................................... 15
发布者:admin,转转请注明出处:http://www.yc00.com/web/1712837519a2131718.html
评论列表(0条)