~/lightning

The Perils of Strict Aliasing

Lightningat CppCon 2014 · on Wednesday, 2014-09-10· at 20:00· Leibnitz· [rust]
links:none on file
slides:none on file

Strict aliasing makes type-punning through differently typed pointers undefined behavior so swapping a uint32 by accessing it as uint16 can silently break; using a union only works as a GCC union copy extension in the copy-in/copy-out pattern, and placement new yields indeterminate values per the standards committee. Workarounds: use memcpy through char pointers (guaranteed), use -fno-strict-aliasing (portable but measurable performance loss observed in market‑data/netcode and the Linux kernel), or use GCC’s may_alias attribute (nonportable).

AI-written summary · about

  1. 0:00Introduction
  2. 1:09C Rules
  3. 1:39Does this work
  4. 1:58Not guaranteed to work
  5. 2:13Unions
  6. 2:59C99
  7. 4:25MemCopy
  8. 5:00Conclusion
~/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.