C++ · 7 · Advanced / Job-Ready35 / 36 · 97%
Modules, ABI & Build Tooling
C++20 modules replace headers — and the rest of a professional build.
Examples: export module, CMake, sanitizers, clang-tidy
shortcuts: ← prev · → next · M mark
1
A Module
Compiled once, imported instantly — no textual inclusion.
Example
example
// math.ixx
export module math;
export int add(int a, int b) { return a + b; }
int helper() { return 0; } // not exported
// main.cpp
import math;
int main() { return add(2, 3); }2
Why Modules Win
Headers are re-parsed in every translation unit.
Headers
| property | behaviour |
|---|---|
| parsing | once per TU |
| macros | leak in and out |
| order | include order matters |
| guards | manual |
Modules
| property | behaviour |
|---|---|
| parsing | once, total |
| macros | isolated |
| order | irrelevant |
| guards | unnecessary |
3
CMake for C++20
A modern, warnings-clean, sanitized build.
Example
CMakeLists.txt
cmake_minimum_required(VERSION 3.28)
project(app CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(app main.cpp)
target_compile_options(app PRIVATE -Wall -Wextra -Wpedantic)
# debug builds with sanitizers
target_compile_options(app PRIVATE
$<$<CONFIG:Debug>:-fsanitize=address,undefined -g>)
target_link_options(app PRIVATE
$<$<CONFIG:Debug>:-fsanitize=address,undefined>)4
Toolchain Checklist
What a production C++ repo runs in CI.
Complexity
| ASan / UBSan | memory + UB bugs | debug + CI |
| TSan | data races | |
| clang-tidy | static analysis | |
| clang-format | consistent style | |
| Catch2 / GoogleTest | unit tests | |
| vcpkg / Conan | dependency management |