CppCast

Standard Library Hardening

Apr 11, 2025
Louis Dionne, code owner of libc++ at Apple and C++ standard committee member, discusses the adoption of the library hardening proposal set for C++26. He emphasizes the importance of enhancing safety and security in C++ through techniques that turn undefined behaviors into clear contract violations. The conversation also delves into innovations like a safe mode for memory safety, evolving hardening techniques, and the balancing act between performance and security. Dionne shares actionable insights for developers eager to adopt these practices today.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
ANECDOTE

Libc++ and always_inline

  • Libc++ used the always_inline attribute on almost all functions to avoid ODR violations.
  • This was later removed, resulting in better compiler optimizations, code size, and debugging.
INSIGHT

always_inline vs. force_inline

  • Clang's always_inline is functionally similar to Microsoft's force_inline attribute.
  • Both impact compilation time, especially with nested calls.
ADVICE

Standard Library Hardening

  • The Standard Library Hardening proposal changes undefined behavior preconditions to contract violations.
  • This makes programs safer by guaranteeing defined behavior in such cases.
Get the Snipd Podcast app to discover more snips from this episode
Get the app