🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3601

Re: Single-line comment and line continuation

#3601
From: James Kanze US/ESC 60/3/141 #407...
Date: Wed, 06 Mar 1996 17:43
38 lines
2696 bytes
In article <4hgbpd$1pl@cnn.Princeton.EDU> tim@franck.Princeton.EDU
(Tim Hollebeek) writes:

|> Steve Clamage (clamage@Eng.Sun.COM) wrote:
|> : >I just ran across something in my C++ compiler dealing with single line 
|> : >comments and the line continuation token:
|> : >
|> : > if ((ch[0] == '\\') && (ch[1] == '\\'))  //look for initial \\
|> : >
|> : >This, under my compiler implementation will choke because of the line 
|> : >continuation token, '\' at the end of the comment.

|> : In C++, simply don't use '//' comments on any line that ends with an
|> : escaped newline (including macro definitions!). In your example, it would
|> : make the comment more readable IMHO if you put the '\\' in quotes anyway,
|> : and would eliminate the problem.

|> Or simply add a single space after the last \, and take advantage of
|> that annoying behavior for once :-)

This will probably work on most Unix implementations, but it is not
guaranteed.  An implementation is allowed to ignore trailing
whitespace when reading in the file.  (This is to facilitate coding in
environments with fixed length records, where the system always pads
your line of code with blanks to make it the fixed length.)

--
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils, itudes et rialisations en logiciel orienti objet --
                -- A la recherche d'une activiti dans une region francophone
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <9603061601.AA10111@lts.sel.alcatel.de>
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
References: <313B3175.331A@strata3d.com> <4hffkm$3f0@engnews1.Eng.Sun.COM> <4hgbpd$1pl@cnn.Princeton.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern
From: James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de>
Newsgroups: comp.std.c++
Subject: Re: Single-line comment and line continuation
Date: 06 Mar 1996 09:43:54 PST
Organization: -
Approved: austern@isolde.mti.sgi.com
Message-ID: <9603061601.AA10111@lts.sel.alcatel.de>
References: <313B3175.331A@strata3d.com> <4hffkm$3f0@engnews1.Eng.Sun.COM> <4hgbpd$1pl@cnn.Princeton.EDU>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: Wed, 6 Mar 96 17:01:52 +0100
In-Reply-To: tim@franck.Princeton.EDU's message of 05 Mar 1996 09:41:20 PST
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMT3O7ky4NqrwXLNJAQG0sQH+LV5EzJRem5DERtzTm0ey5vZXv+hK85bv
 SDTixG5490jIOQYm/FFET6flNMWNIXg0ttSi8D2TPMd/mmxNE2xpmg==
 =w+ad
Originator: austern@isolde.mti.sgi.com