C++ Pitfalls and Sharp Edges to Avoid
summary
Concrete C++ failure modes and concrete defenses: a real bug where a non-void timer callback omits a return and the system loops only on January 2nd; stray semicolons after if, comma-operator misuse in initializers, unspecified evaluation order causing different behaviors, returning references to temporaries, shared_ptr cycles leaking memory, moved-from objects with small-string quirks, and virtual overload/resolution surprises. Recommended defenses are -Wall -Wextra plus flags like -Wnull-dereference, static analysis with clang-tidy, runtime sanitizers (UBSan/ASan/leak), disciplined tests/CI, RAII/strong types, and simpler APIs or state machines.
AI-written summary · about
chapters (11)
- 0:00Introduction and speaker background
- 5:07Essence vs accidental bugs
- 13:15Safety nets: warnings and analyzers
- 21:23Examples of caught bugs
- 30:00Undefined behavior and testing gaps
- 35:19Recurring bugs and documentation
- 40:59Polymorphism and object slicing
- 48:50Type traits and template pitfalls
- 53:43Code smells and refactoring
- 1:00:09Summary and resources
- 1:01:35Q&A session
