Re: Soft return in XCode
Re: Soft return in XCode
- Subject: Re: Soft return in XCode
- From: Oftenwrong Soong <email@hidden>
- Date: Fri, 28 May 2010 10:07:51 -0700 (PDT)
On Fri, May 28, 2010 4:53:52 AM Alastair Houghton <email@hidden> wrote:
>On 28 May 2010, at 12:47, Chris Ridd wrote:
>
>> <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf> (the May 6 2005 committee draft) has this text:
>>
>> 5.1.1.2 Translation phases
>> [...]
>> 2. Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. Only the last backslash on any physical source line shall be eligible for being part [...]
>
>Indeed, though the issue was whether this was legal in a string literal. Apparently it is, because of where that appears in the list of translation phases.
It probably is legal but it is totally unnecessary. If you wish to cut a string literal on one line and continue on the next, the compiler concatenates multiple string literals automatically. You can start and stop a string literal on one line or multiple lines. No slash is needed! This is also safer -- in case someone accidentally adds a space after that backslash character, it would mess everything up. Nothing will be messed up if a space is added after the closing quote.
Example:
char * MyString1 = "This is the beginning "
"of a string "
"that is on multiple lines.";
char * MyString2 = "This is " "a string " "in multiple sets of quotes " "on a single line.";
Objective C strings work the same way except that each opening quote must have the @ sign.
Soong
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden