In some languages, including C++, a macro is a piece of text that undergoes text substitution through expansion (translation) by the preprocessor before compiling.


A macro is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to an output sequence (also often a sequence of characters) according to a defined procedure.

The term originated with macro-assemblers, where the idea is to make a sequence of computing instructions available to the programmer as a single statement, making programming less tedious and less prone to errors. Macro-instructions can eliminate some of the repetitiveness of programming, and also simplify the writing, reading and understanding of the program, because much of the program's complexity can be hidden.


home Home Page