Contents|Index|Previous|Next
Declaring attributes of functions  

In GNU C, you declare certain things about functions called in your program which help the compiler optimize function calls and check your code more carefully.

The keyword, __attribute__, allows you to specify special attributes when making a declaration. This keyword is followed by an attribute specification inside double parentheses. Nine attributes (noreturn, const, format, no_instrument_function, section, constructor, destructor, unused and weak) are currently defined for functions. Other attributes (including section) are supported for variables declarations (see Specifying attributes of variables) and for types (see Specifying attributes of types).

You may also specify attributes with ‘__’ preceding and following each keyword. This allows you to use them in header files without being concerned about a possible macro of the same name. For example, you may use __noreturn__ instead of noreturn.
 



Top|Contents|Index|Previous|Next