Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > inline text, large strings

Reply
Thread Tools

inline text, large strings

 
 
Gernot Frisch
Guest
Posts: n/a
 
      08-17-2004
> The '\' is only to indicate the compiler, that the next line is
> extending this line (as in the #define macros)


....which the OP didn't use. My fault, sorry for not looking exaclty.
Flame me, I'm unworthy to post here....


 
Reply With Quote
 
 
 
 
Dietmar Kuehl
Guest
Posts: n/a
 
      08-17-2004
"Gernot Frisch" <> wrote:
> The original text:
> char as[]="asasd
> asdasd
> asdasd";
> had _no_ newline characters.


Since multi-line string constants are not defined in standard C++, it is
somewhat hard to tell what the standard semantics of the above string are.
I guess that there are at least three cases how the above string is
treated by different systems:
- it is an error
- it is a string with newlines
- it is a string without newline
--
<private.php?do=newpm&u=> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting
 
Reply With Quote
 
 
 
 
Jack Klein
Guest
Posts: n/a
 
      08-18-2004
On Tue, 17 Aug 2004 15:04:16 +0200, "Gernot Frisch" <>
wrote in comp.lang.c++:

> > "now " "a " "lot " "of " "text"
> >
> > is equivalent to "now a lot of text".
> > In other words: The compiler will catanate individual string
> > literals into one literal on its own.

>
> Crap! 5 years of programming things like:
>
> printf(" Here\n\
> comes \
> my \
> text");
> and now you tell me I can add comments and indentination with "" ""...
> Bohooo.. All my pretty source code looks like a piece of #*%& because
> I didn't know that.
> -Gernot


Yes, since the very first 1989 ANSI C standard.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
 
Reply With Quote
 
Gernot Frisch
Guest
Posts: n/a
 
      08-18-2004

"Dietmar Kuehl" <> schrieb im Newsbeitrag
news: om...
> "Gernot Frisch" <> wrote:
> > The original text:
> > char as[]="asasd
> > asdasd
> > asdasd";
> > had _no_ newline characters.

>
> Since multi-line string constants are not defined in standard C++,

it is
> somewhat hard to tell what the standard semantics of the above

string are.
> I guess that there are at least three cases how the above string is
> treated by different systems:
> - it is an error
> - it is a string with newlines
> - it is a string without newline


Re-checked it: VC gives an error, gcc will add a newline.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
matching strings in a large set of strings Karin Lagesen Python 13 05-03-2010 03:53 PM
External Hashing [was Re: matching strings in a large set of strings] Helmut Jarausch Python 3 04-30-2010 08:44 PM
Strings, Strings and Damned Strings Ben C Programming 14 06-24-2006 05:09 AM
To inline or not to inline? Alvin C++ 7 05-06-2005 03:04 PM
inline or not to inline in C++ Abhi C++ 2 07-03-2003 12:07 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57