mikroC
making it simple...
mikroC - C Compiler for Microchip PIC microcontrollers
Line Continuation with Backslash
If you need to break directive into multiple lines, you can do it by ending the line
with a backslash (
):
\
#define MACRO
This directive continues to \
the following line.
Macros
Macros provide a mechanism for token replacement, prior to compilation, with or
without a set of formal, function-like parameters.
Defining Macros and Macro Expansions
The
directive defines a macro:
#define
#define macro_identifier <token_sequence>
Each occurrence of
in the source code following this control
macro_identifier
line will be replaced in the original position with the possibly empty
(there are some exceptions, which are noted later). Such
token_sequence
replacements are known as macro expansions. The
is some-
token_sequence
times called body of the macro. An empty token sequence results in the removal of
each affected macro identifier 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 the macro
expansion. The
terminates at the first non-backslashed new
token_sequence
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 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, such a directive will
not be recognized by the preprocessor. Any occurrences of the macro identifier
found within literal strings, character constants, or comments in the source code
are not expanded
page
126
MikroElektronika: Development tools - Books - Compilers
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?