__attribute__((noalias))

Prevents access of data object through an indirect pointer access.

Syntax
  function-parameter  __attribute__((noalias));
  
  variable-declaration  __attribute__((noalias));
  
  variable-definition  __attribute__((noalias));
  
Remarks

This attribute specifies to the compiler that a data object is only accessed directly, helping the optimizer to generate a better code. The sample code in Example of the noalias attribute will not return a correct result if ip is pointed to a .

Listing 1. Example of the noalias attribute
extern int a __attribute__((noalias));
int f(int *ip)
{
  a = 1;
  *ip = 0;
  return a;   // optimized to return 1;
}