mikroC

making it simple...

PREPROCESSOR

mikroC - C Compiler for Microchip PIC microcontrollers

Preprocessor is an integrated text processor which prepares the source code for compiling. Preprocessor allows:

-inserting text from a specifed file to a certain point in code,

-replacing specific lexical symbols with other symbols,

-conditional compiling which conditionally includes or omits parts of code.

Note that preprocessor analyzes text at token level, not at individual character level. Preprocessor is controled by means of preprocessor directives and preprocessor operators.

Preprocessor Directives

Any line in source code with a leading # is taken as a preprocessing directive (or control line), unless the # is within a string literal, in a character constant, or embedded in a comment. The initial # can be preceded or followed by whitespace (excluding new lines).

The null directive consists of a line containing the single character #. This line is always ignored.

Preprocessor directives are usually placed at the beginning of the source code, but they can legally appear at any point in a program. The mikroC preprocessor detects preprocessor directives and parses the tokens embedded in them. Directive is in effect from its declaration to the end of the program file.

mikroC supports standard preprocessor directives:

# (null directive)

#if

#define

#ifndef

#elif

#ifndef

#else

#include

#endif

#line

#error

#undef

Note: #pragma directive is under construction.

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

125