Abl-electronic PIC Microcontrollers PIC16 Manuel d'utilisateur Page 141

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 312
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 140
Directives #if, #elif, #else, and #endif
The conditional directives #if, #elif, #else, and #endif work very similar to
the common C conditional statements. If the expression you write after the #if
has a nonzero value, the line group immediately following the #if directive is
retained in the translation unit.
Syntax is:
#if
constant_expression_1
<
section_1
>
[#elif
constant_expression_2
<
section_2
>]
...
[#elif
constant_expression_n
<
section_n
>]
[#else
<
final_section
>]
#endif
Each #if directive in a source file must be matched by a closing #endif direc-
tive. Any number of #elif directives can appear between the #if and #endif
directives, but at most one #else directive is allowed. The #else directive, if
present, must be the last directive before
#endif.
The sections can be any program text that has meaning to the compiler or the pre-
processor. The preprocessor selects a single section by evaluating the
constant_expression
following each #if or #elif directive until it finds a
true (nonzero) constant expression. The
constant_expressions
are subject to
macro expansion.
If all occurrences of constant-expression are false, or if no
#elif directives
appear, the preprocessor selects the text block after the
#else clause. If the
#else clause is omitted and all instances of
constant_expression
in the #if
block are false, no section is selected for further processing.
MikroElektronika:
Development
tools
-
Books
-
Compilers
133
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
Vue de la page 140
1 2 ... 136 137 138 139 140 141 142 143 144 145 146 ... 311 312

Commentaires sur ces manuels

Pas de commentaire