Jump to content

C++ Language/Preprocessing/Macros

From Wikibooks, open books for an open world

A "preprocessor macro" enables the effect of cut-and-paste of source code, from that macro's definition (in a #define statement) to anywhere the programmer "expands" that macro.

This cutting-and-pasting action could be parameterized. If a macro has been defined to accept a parameter, its expansion is allowed to pass nothingness. A "variadic macro" is written to accept a variable number of macro-parameters.

Additional information about macros (includes interactive examples)