C++ Common Knowledge
summary
A short live code forensic walks through a tiny buggy program that compiles but crashes showing more than ten real violations and applying fixes one by one until it behaves. Concrete claims: a catalog of 12 concrete pitfalls (uninitialized members, wrong init order, implicit conversions, ODR, missing virtual destructor, slicing, RAII misuse, hidden friends, const this, inline variables, spaceship vs ==, exception safety). Uses C++20 features and GCC Clang MSVC warnings and demonstrates which edits actually stop crashes.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 2:05Buggy C++ code demo
- 5:48C++ best practice violations
- 6:54Fix uninitialized members
- 9:03Declaration vs initialization order
- 11:11Assignment vs initialization
- 14:20Implicit conversion dangers
- 17:12ODR and global variables
- 21:04Resource Acquisition Is Initialization basics
- 27:00RAII and unique pointers
- 27:21Member functions and 'this'
- 34:34Hidden friends and operators
- 39:16Virtual destructors
- 42:49Object slicing and copying
- 46:06Summary
- 46:29Q&A
related talks
55mIdentifying Common Code Smells (In C++)
56mIdentifying Common Code Smells
40mLessons from two decades of writing bad code
59mC++ Code Smells
32mCute C++ Tricks, Part 2 of N: More code you should learn from and never write
30mA Series of Unfortunate Bugs
01h 31mWhat C++ Needs to be Safe
01h 27mContractual Disappointment in C++
