Conditional Compilation - mikroElektronika PIC Microcontrollers PIC12 User Manual

Mikroc user's manual
Table of Contents

Advertisement

mikroC
making it simple...
mikroC - C Compiler for Microchip PIC microcontrollers
Now, the following code,
LCD_PRINT(temp)
will be preprocessed to this:
Lcd_Out_Cp("temp" ": "); Lcd_Out_Cp(IntToStr(temp));
Operator ##
Operator
is used for token pasting: you can paste (or merge) two tokens togeth-
##
er by placing
in between them (plus optional whitespace on either side). The
##
preprocessor removes the whitespace and the
, combining the separate tokens
##
into one new token. This is commonly used for constructing identifiers.
For example, we could define macro
for pasting two tokens into one iden-
SPLICE
tifier:
#define SPLICE(x,y) x ## _ ## y
Now, the call
expands to identifier
.
SPLICE(cnt, 2)
cnt_2
Note: mikroC does not support the older nonportable method of token pasting
using
.
(l/**/r)

Conditional Compilation

Conditional compilation directives are typically used to make source programs
easy to change and easy to compile in different execution environments. mikroC
supports conditional compilation by replacing the appropriate source-code lines
with a blank line.
All conditional compilation directives must be completed in the source or include
file in which they are begun.
page
132
MikroElektronika: Development tools - Books - Compilers

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents