4.3.10 Attributes
The compiler keyword __attribute__()
allows you to
specify special attributes of objects or structure fields. Place inside the parentheses
following this keyword a comma-separated list of the relevant attributes, for example:
__attribute__((unused))
The attribute can be placed anywhere in the object’s definition, but is usually placed as in the following examples.
char __attribute__((weak)) input;
char input __attribute__((weak));
Note: It is important to use variable attributes consistently
throughout a project. For example, if a variable is defined in one file with the
aligned
attribute and declared extern
in another file
without the aligned attribute
, then a link error may result.