This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: String constant concatenation in c-lex.c
- To: Zack Weinberg <zackw at stanford dot edu>
- Subject: Re: String constant concatenation in c-lex.c
- From: Stan Shebs <shebs at apple dot com>
- Date: Thu, 21 Jun 2001 15:35:49 -0700
- CC: gcc-patches at gcc dot gnu dot org
- References: <20010620223353.D12387@stanford.edu>
Zack Weinberg wrote:
>
> There is a silent change to the syntax of Objective C @-strings.
> Formerly, if you had a series of string literals to be concatenated,
> either they all had to have the @ prefix, or none, or you'd get a
> parse error. Now, all @s except the one on the first string literal
> are ignored, so
>
> @"foo" @"bar" "@baz" -> string object
> @"foo" "bar" "baz" -> string object
> "foo" @"bar" @"baz" -> char array
Hmmm. @"" is basically an object constructor, while I think of
string concatenation as lower-level, so it doesn't seem as sensible
to mimic L prefix behavior. It feels almost like having a function
call in the middle of a pile of constant args. I wouldn't even mind
only allowing the middle case, but there would almost certainly be a
compat problem if the first case were disallowed.
Since there's no ObjC committee to debate this endlessly :-), how
about we make our users happy and go with the L prefix rule anyway,
so an @ anywhere in a group of concatenated strings will cause the
result to be an @-string. If that's going to be extra work to
implement, I'll be glad to help.
Stan