Linux Dev Time – Episode 157
Aug 23, 2026 · 26m
Summary
Hosts Joe, Kevin, and Andy debate whether programming macros are a superpower, necessary evil, or mistake. They explain how macros generate code at compile time, contrasting C’s text-based preprocessor with Rust’s safer token-based system and Zig’s `comptime` feature. The discussion highlights benefits like reducing boilerplate but warns of dangers, such as unintended side effects and security risks, emphasizing the need for rigorous testing and careful usage.
Topics discussed
Introduction and defining macros
Macros as code generation and find-and-replace
Rust macros: Token streams vs text manipulation
C/C++ preprocessor macros and their pitfalls
Concrete examples: Boilerplate reduction in Rust
Why use macros? Compile-time vs runtime logic
Safety in Rust and Zig's compile-time execution
Security risks: Arbitrary code execution in macros
The superpower analogy and testing macros
Clap derive macros and the need for caution
Lisp, Zig, and the trade-offs of metaprogramming
Listen ad-free on Castria