PATCH to implement `restrict' in C

Nathan Sidwell nathan@acm.org
Thu Oct 15 01:41:00 GMT 1998


Mark Mitchell wrote:

> In general, it's very straightforward to extend `restrict' to C++.  The
> issue of member function declarations like:
> 
>   struct S {
>     void f() restrict;
>   };
> 
> is tricky, though.  If that `restrict' were `const' it would mean that
> `this' has type `S const*'.  But, `S restrict*' is illegal; `restrict'
> may only refer to pointer (reference) types.  So, using `restrict' in
> this context to mean `S* restrict' would be very un-orthogonal.
Yes, this is unfortunate, but is what I'd done in my previous
C++/restrictedness experience. It made shed loads of improvements
to the object code.

> On the other hand, it would be nice to have a way to indicate that
> `this' is `restrict'ed, and you can't do it at the definition point
> because you don't explicitly declare `this'.  Although I have thought
> about this issue, I have not yet decided what to do.  I think that the
> right thing is to see what EDG-based C++ compilers that support
> `restrict' do, and match it.
I agree. EDG support restricted references too and that's also
important.
I don't know their syntax for that or for member functions.

nathan
-- 
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light      
nathan@acm.org  http://www.cs.bris.ac.uk/~nathan/  nathan@cs.bris.ac.uk



More information about the Gcc-patches mailing list