15.2.6 Const Function Attribute
The
const attribute instructs the compiler to more aggressively
optimize calls to the function. The compiler enforces that such functions
declared with the attribute do not read objects that affect its return value
between successive invocations, such as global objects. However, such
functions can safely read objects that do not change their return value,
such as non-volatile constants. Note that a function which de-references a
pointer argument should not be attributed with const, since
the pointer de-reference uses a value which is not a parameter, even though
the pointer itself is a parameter. For
example:int __attribute((const)) rv(int a);