~/talk

Taking a Byte Out of C++ - Avoiding Punning by Starting Lifetimes

Talkat CppCon 2022 · 2022-09-11..09-16· [rust]
links:none on file
slides:none on file

Claim: C++23 introduces start_lifetime_as to explicitly begin object lifetimes so bytes can back objects without UB from type punning. Shows concrete implementations: memcopy into an aligned byte buffer, a std::like STD bitcast implemented in portable C++20 style, careful use of std::launder, and an expected‑returning API plus Concepts for validation. Applied to a time‑series DB to achieve zero copy page mapping, variable‑length updates, and audited, reusable lifetime‑starting helpers.

AI-written summary · about

  1. 0:00Start
  2. 5:42No Type Punning
  3. 10:36C++ Types May Have Invariants
  4. 12:30Implicit-Lifetime Types (C++20)
  5. 30:55Ending an Object's Lifetime
  6. 40:17Summary
~/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.