~/talk

The Preprocessor: Everything You Need to Know and More!

Talkat CppCon 2021 · on Tuesday, 2021-10-26· at 14:00· online· [rust]
links:none on file
slides:none on file

Preprocessor remains a text‑replacement engine that actually pastes headers into a translation unit (see -E preprocessor dump or Compiler Explorer to inspect .i output), inherited from C but diverging in C++ with modules still not ubiquitous. The talk demonstrates concrete pitfalls: directives have no scope, conditionals treat identifiers as numeric, double-evaluation in function-like macros causes side‑effects, and pragma pack push/pop can silently break serialization unless paired with pop. Practical tools and alternatives shown: __VA_OPT__ caveats, _Generic for C, constexpr/templates/source_location for C++ and use pragmas sparingly.

AI-written summary · about

  1. 0:00Start
  2. 14:41Conditionals
  3. 23:29Code Generation
  4. 32:59Stringification
  5. 35:19Concatenation
~/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.