const
The const function attribute allows you to tell the compiler that the function can safely be called fewer times than indicated in the source code. The language feature provides you with an explicit way to help the compiler optimize code by indicating that the function does not examine any values except its arguments and has no effects except for its return value.
const function attribute syntax >>-__attribute__--((--+-const-----+--))------------------------>< '-__const__-'The following kinds of functions should not be declared const:
- A function with pointer arguments which examines the data pointed to.
- A function that calls a non-const function.
Note: GNU C has a non-attribute method that
uses the const keyword to achieve the const function
attribute, but IBM® XL compiler
does not support this method.