C++ Under the Hood: Internal Class Mechanisms
Talkat CppCon 2024 · on Wednesday, 2024-09-18· at 15:15· Adams A, 6700 North Gaylord Rockies Boulevard·
summary
Concrete demos of how objects get built and torn down: vtable pointer setup during inside‑out construction and outside‑in destruction, and why destructors reassign vtables. Shows how member‑function pointers use compiler thunks for polymorphic dispatch and how member‑data pointers store offsets (null can be nonzero). Live code sketches implement a multicolumn sort using captured member‑data pointers, and a stack‑frame walkthrough explains base pointer links and backtraces on x86. Slides and working examples available; explanations are implementation‑level and practical.
AI-written summary · about
chapters (19)
- 0:00Introduction to C++ under the hood
- 1:03Why internals matter
- 3:13ISA vs HAS-A inheritance
- 3:56Constructors, destructors, vtables
- 9:19Destructing objects outside-in
- 11:33Data and function pointers
- 13:00Function pointers in C
- 15:49C++ sort with function pointers
- 16:30Member function pointers
- 21:36Member data pointers
- 23:47Null in C++
- 27:20Sorting with member pointers & lambdas
- 30:14Memory footprint & vtables
- 38:56Stack frames & base pointers
- 45:38Function return & cleanup
- 46:00Q&A session part one
- 50:15Q&A session part two
- 53:51Q&A session part three
- 55:44Q&A session part four
related talks
01h 00mThe hidden rules of world-class C++ code
06mLightning Talk: Best Practices Every C++ Programmer Needs to Follow
01h 02mEveryday Efficiency: In-Place Construction (Back to Basics?)
01h 01mBack to Basics: Debugging in Cpp
51mSimplicity: Not Just for Beginners
01h 05mBetter Code: Contracts in C++
53mDebug C++ Without Running
40mLessons from two decades of writing bad code
