~/talk

Back to Basics: Casting

Talkat CppCon 2021 · on Wednesday, 2021-10-27· at 15:15· online· [rust]
links:none on file
slides:none on file

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

  1. 0:00Start
  2. 0:27An Introduction
  3. 3:35Implicit Type Conversion
  4. 9:33C++ Functional Cast a.k.a Constructor Call Notation
  5. 11:38Problems with C-style and Functional notation casta
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.