🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2298

Re: C needs reliable comments

#2298
From: P E Smee
Date: Fri, 18 Jan 1991 10:04
33 lines
2026 bytes
In article <2893@cirrusl.UUCP> dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) writes:
>The discussion of // comments started me thinking.  Did you realize
>that C is one of the few programming languages, perhaps the only one,
>in which you can never be sure of correctly commenting stuff out?

Actually, there are lots of them.

>(a) You can use /* and */ to comment out a block of code.  Then
>anywhere in that block, if a */ occurs, the comment terminates
>prematurely.
>
>C badly needs a way of commenting out a block easily.  It needs
>something like this:
>
>#comment  /* begins in column 1; everything following is a comment */
>... stuff to be commented out ...
>... nac esu #tnemmoc ot peek logla sersu yppah ...
>#endc    /* first occurrence of #endc in column one ends #comment block */
>
>The #comment...#endc blocks do not nest, and are required to be in
>column 1, thus avoiding all necessity for parsing tokens.  

No, this proposal is totally isomorphic with /*-*/ comments.  All you
have done is replace the 'meta-operator' /* with <newline>#comment, and
replace */ with <newline>#endc.  If you try to #comment out a block of
code which already contains a #-comment block, everything falls apart.
(IMHO) you MUST invent some form of nesting comment in order to get the
effect you want.  That has its own set of difficulties, which is why it
is such an uncommon feature.

-- 
Paul Smee, Computing Service, University of Bristol, Bristol BS8 1UD, UK
 P.Smee@bristol.ac.uk - ..!uunet!ukc!bsmail!p.smee - Tel +44 272 303132
Technical Details
Message-ID: <1991Jan18.100448.17770@gdr.bath.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!ukc!edcastle!dcl-cs!gdt!exspes
References: <2893@cirrusl.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!ukc!edcastle!dcl-cs!gdt!exspes
From: exspes@gdr.bath.ac.uk (P E Smee)
Newsgroups: comp.std.c
Subject: Re: C needs reliable comments
Message-ID: <1991Jan18.100448.17770@gdr.bath.ac.uk>
Date: 18 Jan 91 10:04:48 GMT
References: <2893@cirrusl.UUCP>
Reply-To: P.Smee@bristol.ac.uk (Paul Smee)
Organization: University of Bristol c/o University of Bath
Lines: 33