This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Implementing "restrict", and other alias questions
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: Implementing "restrict", and other alias questions
- From: John Carr <jfc at tiac dot net>
- Date: Sun, 28 Dec 1997 18:39:59 -0500
- cc: egcs at cygnus dot com
> > Another issue is references: Is
> >
> > void f(class C restrict &);
> >
> > valid.
Adopting the C rules with minimal changes, the reference is
irrelevant. The declaration is valid if and only if it is valid
without the "&".
"class C * restrict &" declares a reference to restrict-qualified
pointer to class C. "class C restrict &" is invalid because restrict
only applies to pointer types.
If references were first class objects like pointers then restricted
references (which are not aliased by any other pointer or reference)
would be possible, but otherwise I can't think of a general way to
declare one without adding yet another ambiguity or special case to
C++ parsing.
> > If so, how does restrict interfere with function overloading?
> In the same way that `register' interferes, that is, not at all.
Restrict is a type qualifier, not a storage class specification. A
special rule would be needed to make it not affect overloading.