文档介绍:Google C++ Style Guide
Revision
Benjy Weinberger
Craig Silverstein
Gregory Eitzmann
Mark Mentovai
Tashana Landray
Each style point has a summary for which additional information is available by toggling the panying arrow button that looks this way: ▽. You may toggle all summaries with the big arrow button:
▽ Toggle all summaries
Table of Contents
Header Files
The #define Guard Header File Dependencies Inline Functions The - FilesFunction Parameter Ordering Names and Order of Includes
Scoping
Namespaces Nested Classes Nonmember, Static Member, and Global Functions Local VariablesStatic and Global Variables
Classes
Doing Work in Constructors Default Constructors Explicit Constructors Copy ConstructorsStructs vs. Classes Inheritance Multiple Inheritance Interfaces Operator ess Control Declaration Order Write Short Functions
Google-Specific Magic
Smart Pointers cpplint
Other C++ Features
Reference Arguments Function Overloading Default Arguments Variable-Length Arrays and alloca()Friends Exceptions Run-Time Type Information (RTTI) Casting StreamsPreincrement and Predecrement Use of const Integer Types 64-bit PortabilityPreprocessor Macros 0 and NULL sizeof Boost C++0x
Naming
General Naming Rules File Names Type Names Variable Names Constant Names Function NamesNamespace Names Enumerator Names Macro Names Exceptions to Naming Rules
Comments
Comment Style ments ments ments ments Punctuation, Spelling and Grammar ments ments
Formatting
Line Length Non-ASCII Characters Spaces vs. Tabs Function Declarations and Definitions
Function Calls Conditionals Loops and Switch Statements Pointer and Reference ExpressionsBoolean Expressions Return Values Variable and Array Initialization Preprocessor DirectivesClass Format Constructor Initializer Lists Namespace Formatting Horizontal WhitespaceVertical Whitespace
Exceptions to the Rules
Existing Non-conformant Code Windows Code
Important Note
Displaying Hidden Details in this Guide
link▽
This