• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Soft return in XCode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Soft return in XCode
      • From: Alastair Houghton <email@hidden>
References: 
 >Soft return in XCode (From: Lorenzo Thurman <email@hidden>)
 >Re: Soft return in XCode (From: Jens Alfke <email@hidden>)
 >Re: Soft return in XCode (From: Alastair Houghton <email@hidden>)
 >Re: Soft return in XCode (From: Scott Ribe <email@hidden>)
 >Re: Soft return in XCode (From: Marco S Hyman <email@hidden>)
 >Re: Soft return in XCode (From: Alastair Houghton <email@hidden>)
 >Re: Soft return in XCode (From: Chris Ridd <email@hidden>)
 >Re: Soft return in XCode (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: Defining custom build configurations for multiple projects
  • Next by Date: Re: Soft return in XCode
  • Previous by thread: Re: Soft return in XCode
  • Next by thread: Re: Soft return in XCode
  • Index(es):
    • Date
    • Thread