Comments, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 45

Advertising
background image

Comments

Comments are pieces of text used to annotate a program, and are technically
another form of whitespace. Comments are for the programmer’s use only; they
are stripped from the source text before parsing. There are two ways to delineate
comments: the C method and the C++ method. Both are supported by mikroC.

C comments

C comment is any sequence of characters placed after the symbol pair

/*

. The

comment terminates at the first occurrence of the pair

*/

following the initial

/*

.

The entire sequence, including the four comment-delimiter symbols, is replaced by
one space after macro expansion.

In mikroC,

int

/* type */

i

/* identifier */

;

parses as:

int

i;

Note that mikroC does not support the nonportable token pasting strategy using

/**/

. For more on token pasting, refer to Preprocessor topics.

C++ comments

mikroC allows single-line comments using two adjacent slashes (

//

). The com-

ment can start in any position, and extends until the next new line. The following
code,

int

i;

// this is a comment

int

j;

parses as:

int

i;

int

j;

MikroElektronika: Development tools - Books - Compilers

37

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Advertising
This manual is related to the following products: