This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: String constant concatenation in c-lex.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]