16.2 Function Attributes and Specifiers

The compiler keyword __attribute__ allows you to specify special attributes of functions. This keyword is followed by an attribute specification inside double parentheses.

You may also specify attributes with __ (double underscore) preceding and following each keyword (e.g., __noreturn__ instead of noreturn). 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__ ((address(0x100), keep))

The attribute specifier can be placed either before or after the function's return type.

Note: It is important to use function attributes consistently throughout a project. For example, if a function is defined in file A with the an attribute, and declared extern in file B without the same attribute, then a link error might result.