# cpp-best-practices/cppbestpractices

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/cpp-best-practices-cppbestpractices).**

8,766 stars · 908 forks · NOASSERTION

## Links

- GitHub: https://github.com/cpp-best-practices/cppbestpractices
- awesome-repositories: https://awesome-repositories.com/repository/cpp-best-practices-cppbestpractices.md

## Topics

`best-practices` `cpp`

## Description

This project is a curated collection of guidelines and technical resources designed to improve C++ code safety, maintainability, and performance. It provides a comprehensive set of coding standards and best practices for establishing consistent naming, formatting, and structural patterns across C++ codebases.

The guide offers specific technical advice on performance optimization, including methods for minimizing object copying, optimizing memory allocation, and reducing compilation cycles. It also provides a directory of tooling recommendations for implementing static analysis, fuzz testing, and binary size profiling.

The resource covers a broad range of capability areas, including memory management patterns, concurrency and multi-threading strategies, and cross-platform portability. It further addresses software quality assurance through debugging, testing methodologies, and build system configuration.

## Tags

### Education & Learning Resources

- [Best Practice Guides](https://awesome-repositories.com/f/education-learning-resources/best-practice-guides.md) — Provides a curated collection of guidelines and technical resources for improving C++ code safety, maintainability, and performance.

### Software Engineering & Architecture

- [Coding Best Practices](https://awesome-repositories.com/f/software-engineering-architecture/coding-best-practices.md) — Offers a curated collection of guidelines to improve the safety, maintainability, and performance of C++ codebases. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/README.md))
- [Coding Standard Recommendations](https://awesome-repositories.com/f/software-engineering-architecture/coding-standard-recommendations.md) — Explains how to establish collaborative coding recommendations for improved safety and performance. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/01-Preface.md))
- [Coding Standards](https://awesome-repositories.com/f/software-engineering-architecture/development-methodologies/engineering-best-practices/code-craftsmanship-standards/coding-standards.md) — Details the application of language conventions and formatting rules to ensure code readability. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/SUMMARY.md))
- [C++](https://awesome-repositories.com/f/software-engineering-architecture/development-methodologies/engineering-best-practices/code-craftsmanship-standards/coding-standards/c.md) — Establishes consistent naming, formatting, and structural guidelines to improve the maintainability of C++ codebases.
- [Naming Conventions](https://awesome-repositories.com/f/software-engineering-architecture/development-methodologies/engineering-best-practices/code-craftsmanship-standards/coding-standards/naming-conventions.md) — Provides standardized naming patterns and structural conventions for C++ code elements. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/03-Style.md))
- [Code Maintainability Principles](https://awesome-repositories.com/f/software-engineering-architecture/development-methodologies/engineering-best-practices/code-quality-design-principles/code-maintainability-principles.md) — Provides design principles and guidelines to ensure C++ code remains readable and easy to modify. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/00-Table_of_Contents.md))
- [Object Copy Minimization](https://awesome-repositories.com/f/software-engineering-architecture/object-copy-minimization.md) — Describes reducing overhead by enabling move operations and avoiding unnecessary temporaries. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/08-Considering_Performance.md))
- [System Performance Optimization](https://awesome-repositories.com/f/software-engineering-architecture/performance-reliability/performance-optimization/data-handling-throughput/system-performance-optimization.md) — Offers technical advice on reducing resource consumption and increasing general execution speed. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/00-Table_of_Contents.md))
- [Arithmetic Type Standards](https://awesome-repositories.com/f/software-engineering-architecture/arithmetic-type-standards.md) — Advises on selecting specific integer and character types to ensure overflow prevention across different architectures. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/06-Considering_Portability.md))
- [Coding Standards Enforcement](https://awesome-repositories.com/f/software-engineering-architecture/coding-standards-enforcement.md) — Details the use of linting tools to automatically check and correct code formatting and naming conventions. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))
- [Compilation Warning Systems](https://awesome-repositories.com/f/software-engineering-architecture/compilation-warning-systems.md) — Explains the use of strict compiler warning flags to detect potential bugs and enforce language standards. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))
- [Logic Patterns](https://awesome-repositories.com/f/software-engineering-architecture/development-best-practices/logic-patterns.md) — Describes applying patterns that clarify developer intent and simplify the debugging process. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/05-Considering_Maintainability.md))
- [Namespace Collision Prevention](https://awesome-repositories.com/f/software-engineering-architecture/namespace-collision-prevention.md) — Recommends using explicit namespaces and avoiding reserved prefixes to prevent identifier conflicts. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/03-Style.md))
- [Runtime Execution Debugging](https://awesome-repositories.com/f/software-engineering-architecture/runtime-execution-debugging.md) — Provides guidance on using debuggers to inspect program state and execution flow to isolate defects. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))
- [Runtime Execution Efficiency](https://awesome-repositories.com/f/software-engineering-architecture/runtime-execution-efficiency.md) — Suggests increasing execution speed through pre-increment operators and avoiding expensive internal exception processing. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/08-Considering_Performance.md))
- [Thread-Safe State Patterns](https://awesome-repositories.com/f/software-engineering-architecture/thread-safe-state-patterns.md) — Explains preventing data races by avoiding global data and utilizing mutexes for thread-safe access. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/07-Considering_Threadability.md))
- [Exception Strategies](https://awesome-repositories.com/f/software-engineering-architecture/type-safe-data-handling/error-handling/exception-strategies.md) — Recommends using exceptions instead of return values to ensure errors are reliably caught and handled. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/04-Considering_Safety.md))

### Part of an Awesome List

- [Code Formatting and Style](https://awesome-repositories.com/f/awesome-lists/devtools/code-formatting-and-style.md) — Provides guidance on using tool-based configurations to maintain consistent indentation and whitespace. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/03-Style.md))
- [Concurrency & Threading](https://awesome-repositories.com/f/awesome-lists/devops/concurrency-threading.md) — Describes strategies for managing concurrent execution to avoid race conditions and deadlocks. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/00-Table_of_Contents.md))
- [Code Complexity Metrics](https://awesome-repositories.com/f/awesome-lists/devtools/code-complexity-metrics.md) — Provides methods for measuring structural codebase complexity to identify components that require refactoring. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))

### Development Tools & Productivity

- [C++ Build Optimization](https://awesome-repositories.com/f/development-tools-productivity/c-build-optimization.md) — Provides methods for optimizing compilation cycles and managing dependencies to improve build speeds.
- [Build Performance Optimization](https://awesome-repositories.com/f/development-tools-productivity/build-performance-optimization.md) — Explains how to minimize build duration by optimizing header includes and reducing template instantiations. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/08-Considering_Performance.md))
- [Build Performance Analyzers](https://awesome-repositories.com/f/development-tools-productivity/build-tooling/build-observability-metadata/build-observability-and-diagnostics/build-performance-analyzers.md) — Details how to identify compilation bottlenecks by tracking total build times and preprocessor load. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/08-Considering_Performance.md))

### Operating Systems & Systems Programming

- [C++ Memory Management](https://awesome-repositories.com/f/operating-systems-systems-programming/manual-memory-management/c-memory-management.md) — Implements smart pointers and ownership patterns to prevent memory leaks and ensure type-safe resource handling.
- [Filesystem Operations](https://awesome-repositories.com/f/operating-systems-systems-programming/filesystem-operations.md) — Provides guidelines for performing consistent file and directory operations across different operating systems using standardized interfaces. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/06-Considering_Portability.md))
- [Safe Containers](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/memory-safety-and-semantics/memory-safety/safe-containers.md) — Recommends replacing C-style arrays with contiguous memory containers to ensure bounds safety. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/04-Considering_Safety.md))

### Programming Languages & Runtimes

- [Automatic Memory Management](https://awesome-repositories.com/f/programming-languages-runtimes/automatic-memory-management.md) — Describes using smart pointers and ownership models to automate resource deallocation and prevent memory leaks. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/04-Considering_Safety.md))
- [Portable C++ Subsets](https://awesome-repositories.com/f/programming-languages-runtimes/c-and-c-cross-compilation/portable-c-subsets.md) — Describes using standards and abstractions to ensure code remains portable across diverse operating systems and hardware architectures. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/00-Table_of_Contents.md))
- [Memory Allocation Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/memory-allocation-optimizations.md) — Describes improving execution speed by preferring stack allocation and using smart pointer factories. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/07-Considering_Threadability.md))
- [Performance Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-compilers/c-compilers/performance-optimizations.md) — Offers technical advice on minimizing object copying and optimizing memory allocation for increased execution efficiency.
- [C++ Tooling Directories](https://awesome-repositories.com/f/programming-languages-runtimes/c-tooling-directories.md) — Provides a directory of recommended tools for implementing static analysis, fuzz testing, and binary size profiling.
- [Inclusion Guards](https://awesome-repositories.com/f/programming-languages-runtimes/header-file-inclusions/inclusion-guards.md) — Details the implementation of include guards to prevent multiple-inclusion errors in header files. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/03-Style.md))
- [Immutable Variables](https://awesome-repositories.com/f/programming-languages-runtimes/immutable-variables.md) — Explains the use of immutable variables and methods to enable compiler optimizations and prevent side effects. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/04-Considering_Safety.md))
- [Variadic Template Arguments](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/generics-templates/variadic-template-arguments.md) — Recommends using variadic templates instead of C-style variadic functions to prevent undefined behavior and security vulnerabilities. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/04-Considering_Safety.md))
- [Operator Overloading](https://awesome-repositories.com/f/programming-languages-runtimes/operator-overloading.md) — Explains how to customize operator behavior to create expressive syntax while adhering to precedence patterns. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/03-Style.md))
- [Standard Library Threading](https://awesome-repositories.com/f/programming-languages-runtimes/standard-library-threading.md) — Explains running multiple operations simultaneously using standard threading libraries to avoid platform-specific APIs. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/06-Considering_Portability.md))
- [Strong Type Definitions](https://awesome-repositories.com/f/programming-languages-runtimes/strong-type-definitions.md) — Recommends using specific strong types instead of generic primitives to prevent logic errors in interfaces. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/09-Considering_Correctness.md))
- [Type Conversion and Casting](https://awesome-repositories.com/f/programming-languages-runtimes/type-conversion-and-casting.md) — Guides the use of explicit casting operators to enable stricter compiler checks and increase visibility of conversions. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/04-Considering_Safety.md))

### Testing & Quality Assurance

- [Code Quality Tools](https://awesome-repositories.com/f/testing-quality-assurance/code-quality-review/code-quality-tools.md) — Recommends standards and refactoring practices to increase software safety and overall code quality. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/11-Further_Reading.md))
- [Static Code Analysis](https://awesome-repositories.com/f/testing-quality-assurance/static-code-analysis.md) — Recommends automated scanning of source code to detect bugs, security vulnerabilities, and maintainability issues. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))
- [Quality Assurance Practices](https://awesome-repositories.com/f/testing-quality-assurance/testing-best-practices-methodologies/quality-assurance-practices.md) — Integrates static analysis, fuzz testing, and sanitizers to detect runtime errors and security vulnerabilities. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/00-Table_of_Contents.md))
- [Mutation Testing Frameworks](https://awesome-repositories.com/f/testing-quality-assurance/automated-test-suites/mutation-testing-frameworks.md) — Describes introducing intentional faults into code to verify the effectiveness of a test suite. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))
- [Code Coverage Analysis](https://awesome-repositories.com/f/testing-quality-assurance/code-coverage-analysis.md) — Explains how to measure the percentage of code executed during tests to find untested logic. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))
- [Fuzz Testing](https://awesome-repositories.com/f/testing-quality-assurance/fuzz-testing.md) — Describes using random or malformed data injection to discover crashes and edge-case bugs. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))
- [Integration Testing](https://awesome-repositories.com/f/testing-quality-assurance/integration-testing.md) — Provides guidelines for validating combined feature sets and individual functions to ensure correct system behavior. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))
- [Performance Profilers](https://awesome-repositories.com/f/testing-quality-assurance/performance-profilers.md) — Explains how to locate runtime bottlenecks by employing profilers to analyze application performance. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/08-Considering_Performance.md))
- [Runtime Error Detectors](https://awesome-repositories.com/f/testing-quality-assurance/runtime-error-detectors.md) — Describes the use of compiler-integrated sanitizers to detect memory corruption and undefined behavior. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md))

### Data & Databases

- [Argument Passing Optimizations](https://awesome-repositories.com/f/data-databases/database-performance-optimizers/column-selection-optimizations/argument-passing-optimizations.md) — Provides technical advice on maximizing processor register use by choosing between passing by value or constant reference. ([source](https://github.com/cpp-best-practices/cppbestpractices/blob/master/04-Considering_Safety.md))
