Function attributes (IBM extension)
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.
A function attribute is specified with the keyword __attribute__ followed by the attribute name and any additional
arguments the attribute name requires. A function __attribute__ specification is included in the declaration or definition of a
function. The syntax takes the following forms:
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.
int __attribute__((attribute_name)) func(int i); //Form 1
__attribute__((attribute_name)) int func(int); //Form 2
int func() __attribute__((attribute_name)); //Form 3
The attribute specification must follow any exception declaration
that might present for the function. For example:int func(int) throw(int) __attribute__((pure));
The following function attributes are supported:
