Implementing "restrict", and other alias questions
John Carr
jfc@tiac.net
Sun Dec 28 15:40:00 GMT 1997
> > 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.
More information about the Gcc
mailing list