User manual
mikroC PRO for dsPIC
MikroElektronika
259
For more information on including les with the #include directive, refer to File Inclusion.
The mikroC PRO for dsPIC30/33 and PIC24 supports standard preprocessor directives:
# (null directive) #if
#dene #ifdef
#elif #ifndef
#else #include
#endif #line
#error #undef
Note: For the time being only funcall pragma is supported.
Line Continuation with Backslash (\)
To break directive into multiple lines end the line with a backslash (\):
#dene MACRO This directive continues to \
the following line.
Macros
Macros provide a mechanism for a token replacement, prior to compilation, with or without a set of formal, function-like
parameters.
Dening Macros and Macro Expansions
The #dene directive denes a macro:
#dene macro_identier <token_sequence>
Each occurrence of macro_identier in the 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 discussed later). Such
replacements are known as macro expansions.token_sequence is sometimes called the body of a macro. An empty
token sequence results in the removal of each affected macro identier from the source code.
No semicolon (;) is needed to terminate a preprocessor directive. Any character found in the token sequence, including
semicolons, will appear in a macro expansion.token_sequence terminates at the rst non-backslashed new line
encountered. Any sequence of whitespace, including comments in the token sequence, is replaced with a single-space
character.
After each individual macro expansion, a further scan is made of the newly expanded text. This allows the possibility
of using nested macros: the expanded text can contain macro identiers that are subject to replacement. However, if
the macro expands into something that looks like a preprocessing directive, such directive will not be recognized by the
preprocessor. Any occurrences of the macro identier found within literal strings, character constants, or comments in
the source code will not be expanded.