This book, "C++ Coding Standards: 101 Rules, Guidelines, and Best Practices" by Herb Sutter and Andrei Alexandrescu, focuses on **writing high-quality, maintainable, and efficient C++ code** 【7】【8】. It distills the collective experience of the C++ community into a comprehensive guide 【9】【10】.
Key themes and topics covered in the book include:
* **Coding Style and Best Practices**:
* Preferring compile-time and link-time errors over run-time errors 【1】.
* Proactive use of `const` 【1】.
* Avoiding macros and magic numbers 【1】.
* Declaring variables as locally as possible and always initializing them 【1】.
* Avoiding long functions and deep nesting 【1】.
* Minimizing definitional dependencies and avoiding initialization dependencies across compilation units 【1】.
* Ensuring type-safe code 【3】.
* Practices that improve code quality regardless of specific language areas, such as using declarative `const` and internal `#include` guards 【5】.
* **Code Quality and Development Process**:
* Investing in **code reviews** to enhance quality and team knowledge 【2】【11】.
* Writing cleaner code faster with fewer hassles 【3】.
* Avoiding gratuitous pessimization by naturally flowing efficient design patterns and coding idioms 【2】.
* **Specific C++ Idioms and Techniques**:
* Rules for type definition 【3】.
* Error handling strategies 【3】.
* Consistent copying and destruction of objects 【2】.
* Judicious use of the Pimpl idiom 【4】.
* Preferring non-member non-friend functions 【4】.
* Providing `new` and `delete` together, and if providing class-specific `new`, providing all standard forms 【4】.
* Ensuring that destructors, resource deallocation functions, and swap functions do not report errors 【2】.
The book is considered an authoritative reference for C++ software development teams and is part of Bjarne Stroustrup's C++ In Depth series 【6】. It covers techniques that may be new even to experienced C++ programmers 【3】.