>  from:    Jonathan Polley <[EMAIL PROTECTED]>
> 
> MSVC was complaining about the latter.  My solution was:
> 
>    cout << "say\n\
> what?\n\
> ";


This is the preferred form in C  :
  cout << "say" << endl
       << "what?!" << endl;

This is OK:
  cout << "say\n"
          "what\n";

This is legal but very bad practice:
  cout << "say\
what\
";

This is not legal:
  cout << "say
what
";

GCC accepts the last (illegal) syntax and doesn't even warn about it unless you use 
the compiler option "-pedantic".  In order to help us write portable code, I recommend 
we all use "-Wall -pedantic" with GCC.

- Julian


> On Thursday, May 16, 2002, at 11:21 PM, Cameron Moore wrote:
> 
> > * [EMAIL PROTECTED] (Curtis L. Olson) [2002.05.16 23:06]:
> >> Update of /var/cvs/FlightGear-0.7/FlightGear/src/Main
> >> In directory seneca:/tmp/cvs-serv26528/src/Main
> >>
> >> Modified Files:
> >>    options.cxx
> >> Log Message:
> >> Bernie Bright:
> >> To make MSVC happy it appears we need backslashes on string literals
> >> spanning multiple lines.
> > <snip/>
> >
> > Can we get a second opinion on the changes in this file?  Why on earth
> > does MSVC bark about this:
> >
> >   cout << "say" << endl
> >        << "what?!" << endl;
> >
> > I can understand this being a problem:
> >
> >   cout << "say
> > what?!
> > ";
> >
> > because of the linefeeds possibly being unix linefeeds, but how is the
> > first example broken?  I'm baffled...
> > --


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to