[comp.std.c] // comments

rex@aussie.UUCP (Rex Jaeschke) (11/10/89)

> Commenting out code is NOT the big reason why inline // comments
> are convenient!  It's so you don't have to remember to close every
> damn time.

How would you then propose the phases of translation problem be 
resolved? Consider the following:

#define A 10   // ..... \<new-line>

Is the backslash part of the comment or is it a continuation 
character?

According to 2.1.1.2, page 6 of the draft, continuation lines are 
recognized before comments. However, the last line of a source file 
CANNOT have a continuation character.

Rex

----------------------------------------------------------------------------
                         ********   NEW POSTAL ADDRESS EFFECTIVE OCT 16th
----------------------------------------------------------------------------
Rex Jaeschke     | C Users Journal     |  Journal of C Language Translation
(703) 860-0091   | DEC PROFESSIONAL    |         2051 Swans Neck Way
uunet!aussie!rex | Programmers Journal |     Reston, Virginia 22091, USA
----------------------------------------------------------------------------
Convener of the Numerical C Extensions Group (NCEG)
----------------------------------------------------------------------------

lhf@aries5.uucp (Luiz H de Figueiredo) (11/10/89)

In article <27.UUL1.3#5077@aussie.UUCP> rex@aussie.UUCP (Rex Jaeschke) writes:
>
>How would you then propose the phases of translation problem be 
>resolved? Consider the following:
>
>#define A 10   // ..... \<new-line>
>
>Is the backslash part of the comment or is it a continuation 
>character?

 The removal of \<new-line> occurs in phase 2, *before* comments are replaced
by spaces.
 For //-comments, the same rule would hold.
--
Luiz Henrique de Figueiredo		internet: lhf@aries5.uwaterloo.ca
Computer Systems Group			bitnet:   lhf@watcsg.bitnet
University of Waterloo
Waterloo, Ontario, Canada  N2L 3G1

reggie@dinsdale.nm.paradyne.com (George W. Leach) (11/18/89)

In article <26.UUL1.3#5077@aussie.UUCP> rex@aussie.UUCP (Rex Jaeschke) writes:

>#if 0
>printf(".....");  /* ... */
>#endif

>This allows you (and always has) to "comment" out code containing 
>comments.

   In fact, it is not such a bad practice to use it to comment code out
period!  At one time I was porting a set of applications to a new version
of our relational database manager.  The new version had some nice new
features added to its embedded query language.  One was a mechanism to
relate the C generated by the embedded query language preprocessor to the
original source by adding comments to the code.  Thus, where we had some
embedded query language code commented out, we all of a sudden had
embedded comments in the generated C!!!!


George W. Leach					AT&T Paradyne 
(uunet|att)!pdn!reggie				Mail stop LG-133
Phone: 1-813-530-2376				P.O. Box 2826
FAX: 1-813-530-8224				Largo, FL 34649-2826 USA