Joined: 30 Jun 2004
|Posted: Wed Sep 21, 2011 3:56 pm Post subject:
|The restriction is to allow optimizations that would not work if the arrays
that are 'pointed to' overlap.
In fortran, it is a rule that if you compile a routine like
real*4 a(n), b(n)
you cannot call
and expect it to work properly, using the same array twice,
foo(c, c(10), n)
cannot be guaranteed to work.
We add the C99 restrict attribute to allow us to use more
optimization techniques, because we know that the arrays sent
as arguments will never overlap.
in C tells the compiler there are no overlapping pointers, and so
we can optimize more.