C + +, as a multi-paradigm language, has the flexibility. Plus some of the skills of C + +, some pits, many companies have their own C + + coding specifications. These specifications are generally recommended what to use, what should not be used, how to name and so on. There is no sketchy to give a complete rule system. Now, with some progress, Bjarne Stroustrup and Herb Sutter Two great gods, on GitHub, launched a project called C + + core guidelines. Project Address: Https://github.com/isocpp/CppCoreGuidelines
The C + + core guidelines are designed to help you use modern modern C + + efficiently. Here modern C + + is not the modern C + + Design book, but refers to c++11 and c++14 (including the immediate arrival of C++17). C++1X represents the rapid development of C + + in the new era, many of the characteristics of other languages have made C + + has a great change. These new features have yet to be validated by the engineering department.
C + + Core guidelines the use of C + + rules is divided into two levels: high level and low level. The advanced level involves interfaces, resource management, concurrency, and so on, and the rules at the advanced level affect the structure of the application and the design of the library. Following the rules at the advanced level, you can keep your code static type safe, without resource leaks, and avoid logic errors in most encodings. The rules at the senior level are for people. Low-level rules are described as coding details, such as naming rules, guaranteed initialization, which are mainly for tools, and the static Check analysis tool can detect whether the code violates the low-level rules. The C + + core guidelines focus on the high-level rules.
The C + + Core guide includes the following:
P:philosophy
I:interfaces
F:functions
C:classes and class hierarchies
Enum:enumerations
Es:expressions and statements
E:error Handling
R:resource Management
T:templates and generic programming
Cp:concurrency
Sl:the Standard Library
Sf:source files
Cpl:c-style programming
Pro:profiles
Gsl:guideline Support Library
Faq:answers to frequently asked questions
The design philosophy mentioned in the C + + Core guide:
P.1:express ideas directly in code
P.2:write in ISO standard C + +
P.3:express Intent
P.4:ideally, a program should is statically type safe
P.5:prefer compile-time checking to run-time checking
P.6:what cannot be checked at compile time should being checkable at run time
P.7:catch Run-time Errors Early
P.8:don ' t leak any resource
P.9:don ' t waste time or space
Interested can go to read, it is best to have someone can translate into Chinese to share to everyone.
[GitHub Project] C + + Core guidelines