liveBook · Manning

Macro parameter

A macro parameter is a named placeholder in a macro definition that receives the corresponding argument from a macro invocation for expansion.

How 2 Manning books explain it

Write Powerful Rust Macros

A macro variable is a named binding in a declarative macro that refers to syntax captured by a matcher.

How it is used
Uses named bindings to pass matched Rust syntax from a declarative macro matcher into its transcriber.
How deep it goes
Defines dollar-prefixed bindings and fragment specifiers, then compares precise matches with broad `tt` matching.
Examples
Demonstrates empty-vector expansion, expression capture, vector insertion, and repeated comma-separated expressions.
What you can do after
Build declarative macro arms that capture expressions and expand them into generated Rust code.

Read how Write Powerful Rust Macros explains macro parameter →

Modern C

A macro parameter is a named placeholder in a function-like macro definition that receives replacement tokens from a macro invocation.

How it is used
Supports reusable textual transformations in C function-like macros during the preprocessing stage.
How deep it goes
Explains naming, argument parsing, recursive expansion, substitution, and stringification, but stops short of broader macro operators.
Examples
Uses BYTECOPY substitutions and trace macros that stringify expressions such as sum and sum*argc.
What you can do after
Apply it via C preprocessing to predict parameter substitution and preserve or stringify invocation arguments deliberately.

Read how Modern C explains macro parameter →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.