Back to Basics: Casting
summary
Explains why C++ keeps four casts and when each actually changes bits, with concrete examples: using static_cast for intentional conversions and inheritance, dynamic_cast for RTTI-checked downcasts (returns null or throws), const_cast to remove qualifiers only when the original object is mutable, and reinterpret_cast for low‑level memory and MMIO (UB risk, no size or aliasing guarantees). Shows compiler selection of C‑style casts, compares costs of dynamic casts, demonstrates bit_cast, as_const, move/forward, and warns when casts hide bugs.
AI-written summary · about
chapters (5)
- 0:00Start
- 0:27An Introduction
- 3:35Implicit Type Conversion
- 9:33C++ Functional Cast a.k.a Constructor Call Notation
- 11:38Problems with C-style and Functional notation casta
related talks
01h 12mCasts in C++: To lie... and hopefully - to lie usefully
01h 10mAn Overview of C++11/14, Part II
12m'Meaningful' casts
01h 00mBack to Basics: Class Layout
01h 01mBack to Basics: C++ API Design
01h 06mBack to Basics: Functions in C++
39mBack to Basics: The Rule of Five in C++
58mLeveraging C++20/23 Features for Low Level Interactions
