Chapter 10 Writing Assembler Control Statements
Conditional Assembly 191
10.4.1 #ifdef, #ifndef
Syntax
Syntax for #ifdef Syntax for #ifndef
#ifdef identifier #ifndef identifier
block1 block1
[#else [#else
block2] block2]
#endif #endif
Functional description
#ifdef
If the identifier has been defined by a #define directive before the #ifdef statement, block1 will be
assembled. If it has not been defined and an #else directive has been coded, block2 will be assembled.
#ifndef
If the identifier has not been defined by a #define directive before the #ifndef statement, block1 will be
assembled. If it has been defined and an #else directive has been coded, block2 will be assembled.
Coding rules
These directives can be used within macro definitions and wherever machine language instructions can
be coded.
If an identifier is defined after #ifdef or #ifndef, it will be considered undefined.
Identifiers can be specified by the D option when the assembler is started, even if they are not defined
with #define directives.