This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH to implement `restrict' in C


On Fri, Oct 09, 1998 at 01:15:28PM -0700, Mark Mitchell wrote:
>   int* restrict i;
>   int* restrict j;
>   int* k;
> 
> we know that `i' and `j' cannot point to the same thing, but either
> might alias the storage point to by `k'.

This was not my understanding of the definition of restrict.
My understanding is that it is intended to signify that that
pointer contains the _only_ reference to a block of memory.

Quoting n2620.pdf (whatever version of the c9x draft that was):
~~~~~
4  During each execution of [block] B, let A be the array object that is
   determined dynamically by all references through pointer expressions
   based on [the restricted pointer] P. Then _all_ [emph theirs] references
   to values of A shall be through pointer expressions based on P.
...
7     1.  The file scope declarations
	int * restrict a;
	int * restrict b;
	extern int c[];
      assert that if an object is referenced using the value of one of a,
      b, or c, then it is never referenced using the value of either of
      the other two.
~~~~~

This makes restrict significantly easier to implement than
you make out.  None of the subset bits should be necessary.



r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]