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: jfc at tiac dot net (John Carr), egcs at cygnus dot com
- Subject: Re: Implementing "restrict", and other alias questions
- From: Jason Merrill <jason at cygnus dot com>
- Date: 06 Jan 1998 11:31:18 -0800
- References: <19971228151244.16910@dot.cygnus.com><199712282339.SAA18438.cygnus.egcs@jfc>
>>>>> John Carr <jfc@tiac.net> writes:
> "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.
Huh? 'class C & restrict' makes perfect sense to me. & is parsed just
like * in a declarator.
>> > 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.
Initially, the easy approach would be for it to be ignored in overloading.
It might be useful to define separate restrict/non-restrict versions, but
you can't use alias analysis in overload resolution, so the restrict
version would only be called for arguments that already have restrict
applied.
Jason