~/talk

*(char*)0 = 0; - What Does the C++ Programmer Intend With This Code?

Talkat C++ on Sea 2023 · 2023-06-28..06-30· [c-and-cpp]
github:jfbastien
slides:none on file

Simple program (char)0 = 0; provokes lots of specific behaviors: compilers optimize or trap (for example clang -O2 drops it while GCC sometimes inserts a trap), std::bit_cast diagnostics differ from __builtin_bitcast, and changing 0 to -0 can silence a front‑end check. Experiments compile and run into SIGSEGV on many OSes; emulation and tooling (GDB, valgrind/Cachegrind, QEMU) reproduce hardware effects. The code surfaces undefined behavior, page‑table/TLB interactions, and mismatches between language intent, compiler diagnostics, and real hardware.

AI-written summary · about

  1. 0:00Introduction
  2. 1:27Interview question context
  3. 5:18Code breakdown and null deref
  4. 9:08C++ rewrite and compiler errors
  5. 17:40Fixing and running code
  6. 22:21Code behavior perspectives
  7. 26:12Objects, memory mapping, hardware
  8. 28:20Memory protection and mapping
  9. 33:30Page tables and lookups
  10. 40:12How caches speed memory
  11. 43:02TLBs and cache hierarchy
  12. 49:00Debugging and simulation
  13. 51:03Code meaning and specs
  14. 52:48Human side of low-level
  15. 53:29Closing remarks
~/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.