6.31. Declaring Attributes of Functions
6.31 Declaring Attributes of Functions
In GNU C, you can use function attributes to declare certain things about functions called in your program which help the compiler optimize calls and check your code more carefully. For example, you can use attributes to declare that a function never returns (noreturn
), returns a value depending only on its arguments (pure
), or has printf
-style arguments (format
).
You can also use attributes to control memory placement, code generation options or call/return conventions within the function being annotated. Many of these attributes are target-specific. For example, many targets support attributes for defining interrupt handler functions, which typically must follow special register usage and return conventions.
Function attributes are introduced by the __attribute__登录查看完整内容