Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
MPLAB
®
XC16 C COMPILER
USERS GUIDE
2012-2013 Microchip Technology Inc. DS50002071C-page 217
Chapter 19. Preprocessing
19.1 INTRODUCTION
All C source files are preprocessed before compilation. The -E option can be used to
preprocess and then stop the compilation. See Section 5.7.2 Options for
Controlling the Kind of Output.
Assembler files can also be preprocessed if the file extension is .S rather than .s (see
Section 5.2.3 Input File Types.)
Items discussed in this section are:
C Language Comments
Preprocessing Directives
Predefined Macro Names
Pragmas vs. Attributes
19.2 C LANGUAGE COMMENTS
The MPLAB XC16 C Compiler supports standard C comments, as well as C++ style
comments. Both types are illustrated in the following table.
19.3 PREPROCESSING DIRECTIVES
The compiler accepts several specialized preprocessor directives in addition to the
standard directives. All of these are listed in Table 19-1.
Comment Syntax Description Example
/* */ Standard C code comment.
Used for one or more lines.
/* This is line 1
This is line 2 */
// C++ code comment. Used for
one line only.
// This is line 1
// This is line 2
TABLE 19-1: PREPROCESSOR DIRECTIVES
Directive Meaning Example
#define Define preprocessor macro #define SIZE 5
#define FLAG
#define add(a,b) ((a)+(b))
#elif Short for #else #if see #ifdef
#else Conditionally include source lines see #if
#endif Terminate conditional source inclusion see #if
#error Generate an error message #error Size too big
#if Include source lines if constant
expression true
#if SIZE < 10
c = process(10)
#else
skip();
#endif
Protego_Release_01_05-Related-OEM-Documentation-MPLAB-XC16-C-Compiler.pdf