Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル
製品コード
SW006021-1
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 210
2012 Microchip Technology Inc.
5.14
PREPROCESSING
All C source files are preprocessed before compilation. The preprocessed file is not
deleted after compilation. It will have a .pre extension and the same base name as
the source file from which it is derived.
deleted after compilation. It will have a .pre extension and the same base name as
the source file from which it is derived.
The --PRE option can be used to preprocess and then stop the compilation. See
Section 4.8.46 “--PRE: Produce Preprocessed Source Code”.
Section 4.8.46 “--PRE: Produce Preprocessed Source Code”.
Assembler files can also be preprocessed if the -P driver option is issued. See
Section 4.8.11 “-P: Preprocess Assembly Files”.
Section 4.8.11 “-P: Preprocess Assembly Files”.
5.14.1
C Language Comments
The MPLAB XC8 C compiler supports standard C comments, as well as C++ style com-
ments. Both types are illustrated in the following table.
ments. Both types are illustrated in the following table.
5.14.2
Preprocessor Directives
MPLAB XC8 accepts several specialized preprocessor directives in addition to the
standard directives. All of these are listed in Table 5-11 on the next page.
standard directives. All of these are listed in Table 5-11 on the next page.
Macro expansion using arguments can use the # character to convert an argument to
a string, and the ## sequence to concatenate arguments. If two expressions are being
concatenated, consider using two macros in case either expression requires
substitution itself, so for example
a string, and the ## sequence to concatenate arguments. If two expressions are being
concatenated, consider using two macros in case either expression requires
substitution itself, so for example
#define __paste1(a,b) a##b
#define __paste(a,b) __paste1(a,b)
lets you use the paste macro to concatenate two expressions that themselves may
require further expansion. Remember also that once a macro identifier has been
expanded, it will not be expanded again if it appears after concatenation.
require further expansion. Remember also that once a macro identifier has been
expanded, it will not be expanded again if it appears after concatenation.
Comment Syntax
Description
Example
/* */
Standard C code comment.
Used for one or more lines.
Used for one or more lines.
/* This is line 1
This is line 2 */
//
C++ code comment. Used for
one line only.
one line only.
// This is line 1
// This is line 2