Awesome Macros That Do Nothing
summary
Proposes using simple C++ macros as documentation-only annotations to show parameter direction and ownership, applied to an example function with five pointers so it’s clear which are inputs, which are outputs and which transfer ownership. Uses IN and OUT on parameters, and TRANS and ISO to indicate ownership semantics. The annotations compile away and do not enforce safety but make lifetime expectations explicit and immediately usable when reading APIs.
AI-written summary · about
chapters (4)
- 0:00Introduction to API macros
- 0:34Labeling function parameters
- 1:45Defining ownership semantics
- 4:05Practical applications
related talks
39mRust metaprogramming - macro_rules! beyond basics
01h 39m“Thoughts on a more powerful and simpler C++ (5 of N)”
42mAvoiding macros with inline and derived
06mCode Generation: The Lisp Way
01h 34mKeynote: Reflection Is Only Half the Story
13mTowards Macro-Aware C-to-Rust Transpilation (WIP)
45mDeveloping Macros in Rust
01h 03mModern Macros
