Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 ユーザーズマニュアル

製品コード
SW006021-1
ページ / 518
Common C Interface
 2012 Microchip Technology Inc.
DS52053A-page 15
For freestanding implementations – or for what we typically call embedded applications 
– the standard allows non-standard extensions to the language, but obviously does not 
enforce how they are specified or how they work. When working so closely to the 
device hardware, a programmer needs a means of specifying device setup and inter-
rupts, as well as utilizing the often complex world of small-device memory 
architectures. This cannot be offered by the standard in a consistent way.
While the ANSI C Standard provides a mutual understanding for programmers and 
compiler vendors, programmers need to consider the implementation-defined behavior 
of their tools and the probability that they may need to use extensions to the C language 
that are non-standard. Both of these circumstances can have an impact on code por-
tability.
2.2.2
The Common C Interface
The Common C Interface (CCI) supplements the ANSI C Standard and makes it easier 
for programmers to achieve consistent outcomes on all Microchip devices when using 
any of the MPLAB XC C compilers.
It delivers the following improvements, all designed with portability in mind.
Refinement of the ANSI C Standard 
The CCI documents specific behavior for some code in which actions are implemen-
tation-defined behavior under the ANSI C Standard. For example, the result of 
right-shifting a signed integer is fully defined by the CCI. Note that many 
implementation-defined items that closely couple with device characteristics, such as 
the size of an int, are not defined by the CCI.
Consistent syntax for non-standard extensions 
The CCI non-standard extensions are mostly implemented using keywords with a uni-
form syntax. They replace keywords, macros and attributes that are the native com-
piler implementation. The interpretation of the keyword may differ across each com-
piler, and any arguments to the keywords may be device specific.
Coding guidelines 
The CCI may indicate advice on how code should be written so that it can be ported 
to other devices or compilers. While you may choose not to follow the advice, it will 
not conform to the CCI.