mikroC

mikroC - C Compiler for Microchip PIC microcontrollers

making it simple...

 

 

 

 

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 together 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 SPLICE for pasting two tokens into one iden- tifier:

#define SPLICE(x,y) x ## _ ## y

Now, the call SPLICE(cnt, 2) expands to identifier 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