~/talk

Everything you want to know about C/C++ pre-processor but couldn't ask

Talkat NDC TechTown 2018 · 2018-09-27..09-30· [compilers-and-language-design]
slides:none on file

Claims the C/C++ preprocessor is almost Turing complete and demonstrates concrete tricks and pitfalls: string-literal concatenation that changes compiler input, a swap macro fixed by argument parenthesization and a generated temp name using token-pasting with a required double expansion to avoid swap macro name clash, a RAII-style resource macro using nested for-loops that works for FILE and va_list, and a full preprocessor FizzBuzz implemented with recursive-repeat, decrement and boolean hacks and validated via the #include-as-test technique — it compiles and the tests pass.

AI-written summary · about

  1. 0:00Start
  2. 3:16String Literal Concatenation
  3. 5:56Swap Macro
  4. 6:08Swap Micro
  5. 26:11Fizzbuzz in the Preprocessor
  6. 28:07Repeat Macro
  7. 28:46How Do We Decrement a Variable
  8. 35:49Fizzbuzz
~/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.