Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

Common C Interface
2012-2013 Microchip Technology Inc. DS50002071C-page 21
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 imple-
mentation-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 uniform syntax. They replace keywords, macros and attributes that are the
native compiler implementation. The interpretation of the keyword may differ
across each compiler, and any arguments to the keywords may be device spe-
cific.
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.

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh