mikroC
making it simple...
mikroC - C Compiler for Microchip PIC microcontrollers
A macro won’t be expanded during its own expansion (so #define MACRO MACRO won’t expand indefinitely).
Let’s have an example:
/* Here are some simple macros: */ #define ERR_MSG "Out of range!" #define EVERLOOP for( ; ; )
/* which we could use like this: */
main() {
EVERLOOP {
...
if (error) {Lcd_Out_Cp(ERR_MSG); break;}
...
}
}
Attempting to redefine an already defined macro identifier will result in a warning unless the new definition is exactly the same
#ifndef BLOCK_SIZE #define BLOCK_SIZE 512
#endif
The middle line is bypassed if BLOCK_SIZE is currently defined; if BLOCK_SIZE is not currently defined, the middle line is invoked to define it.
|
| page |
|
MikroElektronika: Development tools - Books - Compilers | 127 | ||
|
|