About restrict keyword in C functions

Hi, All:

In most OpenACC training slides, e.g. saxpy function in


slide 14:

void saxpy(int n, float a, float * x, float *restrict y);

It seems only one restrict keyword in front of y is needed for the compiler to recognize parallelism and independence between x and y, I am just wondering why the restrict keyword is not also added in front of x? Why does the compiler figure out x is not aliased with y?

Thanks a lot,


Hi Feng,

“x” is read-only so doesn’t need “restrict”.

  • Mat