Vault 7: Projects

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

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 130 2012-2013 Microchip Technology Inc.
8.12 VARIABLE ATTRIBUTES
The MPLAB XC16 C Compiler uses attributes to indicate memory allocation, type and
other configuration for variables, structure members and types. Other attributes are
available for functions, and these are described in Section 13.2.2 Function Attri-
butes. Qualifiers, listed in Section 8.11 Compiler-Specific type Qualifiers, are
used independently to attributes. They only indicate how objects are accessed, but
must be used where necessary to ensure correct code operation.
The compiler keyword __attribute__ allows you to specify the attributes of objects.
This keyword is followed by an attribute specification inside double parentheses. The
following attributes are currently supported for variables:
address (addr)
aligned (alignment)
boot
deprecated
eds
fillupper
far
mode (mode)
near
noload
page
packed
persistent
reverse (alignment)
section ("section-name")
secure
sfr (address)
space (space)
transparent_union
unordered
unsupported(message)
unused
weak
You may also specify attributes with __ (double underscore) preceding and following
each keyword (e.g., __aligned__ instead of aligned). This allows you to use them
in header files without being concerned about a possible macro of the same name.
To specify multiple attributes, separate them by commas within the double
parentheses, for example:
__attribute__ ((aligned (16), packed)).
Note: It is important to use variable attributes consistently throughout a project.
For example, if a variable is defined in file A with the far attribute, and
declared extern in file B without far, then a link error may result.

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh