Syntax
#define macro_identifier <token_sequence>
Description
The #define directive defines a macro. Macros provide a mechanism for token replacement with or without a set of formal, function-like parameters.
Each occurrence of macro_identifier in your source code following this control line will be replaced in the original position with the possibly empty token_sequence (there are some exceptions, which are noted later). Such replacements are known as macro expansions. The token sequence is sometimes called the body of the macro.
An empty token sequence results in the removal of each affected macro identifier from the source code.
After each individual macro expansion, a further scan is made of the newly expanded text. This allows for the possibility of nested macros: The expanded text can contain macro identifiers that are subject to replacement. However, if the macro expands into what looks like a preprocessing directive, the directive will not be recognized by the preprocessor. There are these restrictions to macro expansion:
#define HI "Have a nice day!" #define empty
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|