cpp-guide
Installation
SKILL.md
C/C++ Guide
Applies to: C++20, Systems Programming, Embedded, Game Engines, High-Performance Computing
Core Principles
- RAII Everywhere: Every resource (memory, files, locks, sockets) is owned by an object whose destructor releases it
- Zero Raw Ownership: Never use
new/deletedirectly; use smart pointers and containers for all heap allocation - Value Semantics by Default: Pass and return by value; rely on move semantics and copy elision for performance
- Compile-Time over Run-Time: Use
constexpr,static_assert, concepts, and templates to catch errors at compile time - Warnings Are Errors: Build with
-Wall -Wextra -Wpedantic -Werror; every warning is a latent bug
Guardrails
Standard & Compiler
- Use C++20 as the minimum standard (
-std=c++20/CMAKE_CXX_STANDARD 20) - Compile with at least
-Wall -Wextra -Wpedantic; treat warnings as errors (-Werror) - Enable sanitizers in debug builds:
-fsanitize=address,undefined
Related skills