The soul of this release is the full refactoring and updating of the "Code Conventions" chapter:
- All code conventions have been reviewed again, adding missing items and improving the organization of the existing ones
- "Core C+"+ code convention has been fully added
- Mentioned code convention tools like
clang-tidy
- All bullet points now have links to the official convention descriptions
- The chapter has been split into two lectures and organized into several subsections to improve the readability
Introduction:
- Updated main charts: "C++ popularity" and "compute-trend"
Preparation:
- Books updated: "Professional C++", "Programming and Principles using C++"
Basic Concepts II:
- Improved "Integral data type" section: description of
ptrdiff_t
, addeduintptr_t
, added hardware relation with integral arithmetic - Added saturation arithmetic functions C++26 for integral data types
- Improved signed integer and bitwise operations description
Basic Concepts III:
- Added C++ attributes section
- Moved "namespace" section here and added improvements: using namespace, using declaration in details
- Added alternative syntax for namespace
- Added an example of "using enum" pre-C++20
Basic Concepts IV:
- Fixed "
constexpr
Function - Limitations" and minor section improvements - Described the relation between
constexpr
function and argument lifetime - Better explanation and more examples for
static_cast
,reinterpret_cast
,const_cast
,bit_cast
- Added
narrow_cast
and "uniform initialization cast" - Mentioned the behavior of
auto
within structures - Mentioned the behavior of
constexpr
and structure binding - Described
volatile
deprecation in C++20 - Moved pointer description before "Heap and Stack"
- Added C++23 type safe placement allocation function
Basic Concepts V:
- Added "Boost Predef" library reference for common macros
- Added template lambda emulation
- Added an example of template lambda without automatic deduction
- Added the relation between lambda expression and function
- Described recursive lambda and lambda within another lambda
- Added C++23 lambda expressions with optional parameters
- Reported GCC 14 flag
-fdiagnostics-all-candidates
Object-Oriented Programming II:
- Improved Polymorphism introduction and added "C++ Mechanisms for Polymorphism"
Template and Metaprogramming II:
- Added
-Wfatal-errors
to "Template Debugging" section
Translation Units II:
- Improved C++ libraries section. Clarified building steps, environment variables, usage, and ABI
- Small improvements in the "compiling multiple translation units" section
Debugging:
- Added
Boost::Assert
andBoost::stacktrace
to assertion section - Added
GWPSan
Sampling-based Sanitizer - Added additional compiler flags to help debugging
Ecosystem:
- Updated the "AI-Powered Code Completion" tools
- Books updated
Utilities:
- Added a section for random number generator for "Recent Algorithms and Performance"
- Improved the seed generation section
Advanced Topics I:
- Fixed type deduction example for array
Optimization I:
- Added new references in the "Introduction" section
- Improved "Arithmetic Intensity" section
Optimization II:
- Added a few notes about loop optimization
- Improved memory alignment section and added C++20
std::assume_aligned
- Fixed C++17 alignment function and added an example
- Updated
pragma unroll
compiler support - Added a new reference for hash table comparison
- Added MSVC
forceinline
attribute and adopted C++11 syntax
Optimization III:
- Added official link to LLVM Bolt project and a new benchmark
- Added a benchmark for "Polyhedral Optimizations"
- Added
-fprefetch-loop-arrays
optimization flag - Added userspace governor setting for cpu frequency
- Added "Hash-prospector" as replacement for PRNG
- Added optimized linear and binary search in "External libraries" section
- Added
target
andtarget_clones
function attributes
Software Design I:
- Refactored "Member Functions vs. Free Functions" -> "Class Design"
Thanks for all feedback and contributions: @FisherKKK, @JDRanpariya, @YueLu0116, @luck-tian, @D4arkShad0w, @DYNIO1999, @saveasguy, @leofracca, @Dong-kyu-Lee, @ChoiSeonMun, @viktorteren, @ChoiSeonMun, @Mati-as, @RuimingShen, @abzrg, @xintin, @russkel, @binary-manu