Function attributes are extensions implemented to enhance the portability of programs developed with GNU C. Specifiable attributes for functions provide explicit ways to help the compiler optimize function calls and to instruct it to check more aspects of the code. Others provide additional functionality.
Function attribute syntax: function declaration >>-function declarator--__attribute__---------------------------> .-,--------------------------. V | >--((----+-attribute_name---------+-+--))--;------------------->< '-__--attribute_name--__-'
/* Specify the attribute on a function prototype declaration */
void f(int i, int j) __attribute__((individual_attribute_name));
void f(int i, int j) { }
Due to ambiguities in parsing old-style parameter declarations,
a function definition must have the attribute specification precede the
declarator: int __attribute__((individual_attribute_name)) foo(int i) { }
You can specify attribute_name with or without
leading and trailing double underscore characters; however, using
the double underscore characters reduces the likelihood of name conflicts
with macros of the same name. These language features are collectively
available when compiling in any of the extended language levels.
The following function attributes are supported: