C-style preprocessor directives
Syntax
#define symbol text
#elif condition
#else
#endif
#error "message"
#if condition
#ifdef symbol
#ifndef symbol
#include {"filename" | <filename>}
#message "message"
#undef symbol
Parameters
| An absolute assembler expression, see Expressions, operands, and operators. The expression must not contain any assembler labels or symbols, and any non-zero value is considered as true. The C preprocessor operator |
| Name of file to be included or referred. |
| Text to be displayed. |
| Preprocessor symbol to be defined, undefined, or tested. |
| Value to be assigned. |
Description
The assembler has a C-style preprocessor that is similar to the C89 standard.
Note
The preprocessor expressions use the same precedence rules as the assembler operators.
These C-language preprocessor directives are available:
Directive | Description |
|---|---|
| Assigns a value to a preprocessor symbol. |
| Introduces a new condition in an |
| Assembles instructions if a condition is false. |
| Ends an |
| Generates an error. |
| Assembles instructions if a condition is true. |
| Assembles instructions if a preprocessor symbol is defined. |
| Assembles instructions if a preprocessor symbol is undefined. |
| Includes a file. |
| Generates a message on standard output. |
| This directive is recognized but ignored. |
| Undefines a preprocessor symbol. |
You must not mix assembler language and C-style preprocessor directives. Conceptually, they are different languages and mixing them might lead to unexpected behavior, as an assembler directive is not necessarily accepted as a part of the C preprocessor language.
Note
The preprocessor directives are processed before other directives. As an example, avoid constructs like:
redef macro ; Avoid the following!
#define \1 \2
endmbecause the \1 and \2 macro arguments are not available during the preprocessing phase.