Arthur O'Dwyer demonstrates how C's designated initializers can simulate named, defaultable function arguments using struct initialization and variadic macros. The technique leverages two C features: initializer order independence and last-writer-wins override semantics.
Background
C lacks native support for named parameters or optional arguments unlike languages such as Python or Rust. This pattern is a well-known idiom originating from Ben Klemens' 21st Century C (2014).
- Source
- Lobsters
- Published
- Nov 17, 2026 at 11:58 PM
- Score
- 6.0 / 10