MODULE 09 · ADVANCED

Systems Error Handling, std::expected, and SanitizersC++ Systems Programming · Module 9

Eliminate runtime exceptions in performance-critical code: exception safety guarantees, zero-overhead std::expected (C++23), std::optional, and Address/Thread Sanitizers.

4 lessons16 min readingCustom Allocators, Multi-Threading & Lock-Free Atomics
Free, self-paced, and open to everyone. No account needed.
WHAT THIS MODULE COVERS

Systems Error Handling, std::expected, and Sanitizers

Eliminate runtime exceptions in performance-critical code: exception safety guarantees, zero-overhead std::expected (C++23), std::optional, and Address/Thread Sanitizers.

BEFORE YOU START

Class design and templates

WHAT YOU’LL BE ABLE TO DO

Command of exception safety contracts, zero-overhead C++23 std::expected, std::optional, and dynamic sanitizers.

THE LESSON SEQUENCE

Read in order, or jump to what you need.

Every lesson builds on the one before it. Open any lesson to read the explanation, run the examples, and try the practice challenges.

  1. 09.01
    Exception Safety Guarantees: Basic, Strong, and No-throw Contracts

    Analyze the four levels of exception safety contracts: No-throw (noexcept), Strong (commit-or-rollback), Basic (no leaks, valid invariants), and No Guarantee.

    4 min
  2. 09.02
    Zero-Overhead Error Handling: std::expected and Functional Monads

    Master C++23 std::expected for deterministic, exception-free systems programming: monadic chaining (and_then, or_else), value-or-error representations, and typed error enums.

    4 min
  3. 09.03
    Nullable Value Semantics: std::optional and In-Place Storage

    Model optional presence cleanly: std::optional<T>, nullopt sentinels, value_or defaults, monadic operations, and zero-allocation in-place storage.

    4 min
  4. 09.04
    Dynamic Analysis: AddressSanitizer, UndefinedBehaviorSanitizer, and Valgrind

    Detect systems vulnerabilities at runtime: AddressSanitizer (-fsanitize=address), UBSan (-fsanitize=undefined), ThreadSanitizer, shadow memory, and Valgrind Memcheck.

    4 min
MODULE SELF-CHECK

Ready to move on?

Build exception-free monadic error pipelines and run test suites under AddressSanitizer.

Open the module self-check