Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
#define
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Directive: #define
Syntax: #define identifier substitution-text
#define identifier([parameter-list]) substitution-text
Summary: Replaces all subsequent cases of <identifier> with
the <substitution-text>.
See also: defined, #if, #ifdef, #ifndef, #undef
The <substitution-text> can consist of one or more constants,
keywords, or statements. When the identifier is replaced by a
constant expression, it is known as a manifest constant. When the
identifier is replaced by an expression containing parameters, it
is known as a macro.
If the <substitution-text> is more than one line, it can be
continued onto successive lines by placing a backslash (\) before
the end of each line. Enclosing the <substitution-text> in
parentheses ensures proper evaluation if the text is an
expression, or has a leading minus sign. The <substitution-text>
can also be empty; this removes occurrences of the identifier from
the file.
If a <parameter-list> appears after the identifier, each
occurrence of <identifier>(<actual-parameter-list>) is replaced by
a version of the <substitution-text> that has actual arguments
substituted for the formal parameters. There must be an equal
number of actual arguments and formal parameters.
The optional <parameter-list> consists of one or more formal
parameter names, separated by commas and enclosed by parentheses.
No space can separate the identifier and the opening parenthesis.
The formal parameter names appear in the <substitution-text> to
mark the places where actual values will be substituted.
Macros may also use the preprocessor operators.
See: ◄Stringizing Operator►
◄Charizing Operator►
◄Token-Pasting Operator►
-♦-