Article View: comp.std.c
Article #2227Re: comment style
From: Superuser
Date: Sat, 29 Dec 1990 09:51
Date: Sat, 29 Dec 1990 09:51
42 lines
2430 bytes
2430 bytes
In article <MCDANIEL.90Dec28110944@dolphin.adi.com> mcdaniel@adi.com (Tim McDaniel) writes:
>iverson@ivy.uucp (Tim Iverson) screwed up, I'm afraid.
Arrrggggghhhh! Yes, I screwed up - though I can honestly say that in 5 years
of programming in C, I've never had a problem with it. Probably because
comments /* in the middle */ of a line are rare (nonexistent in my own code).
> gcc -Wall -ansi -pedantic 72.c
I should have known this group would be full of nit-picking pedants :-)
> 72.c:2: warning: `/*' within comment
> 72.c:3: warning: `/*' within comment
> 72.c:3: unterminated string or character constant
I also never intended the actual lines to be fed into a real compiler.
They were intended to illustrate a point and communicate at the same time -
after all, walking and chewing gum at the same time works.
>The `*/' on line 3 ends the comment block. Iverson's scheme works
>only if all existing comments fall at the end of the line.
After reading this and realizing the flaw in this technique, I kept on
trying to justify using to myself, but the only thing about it that appeals
to me now is that it is esthetically pleasing to look at - it really jumps
out of the page on a listing. Perhaps now I'll change to using #ifdef
full-time instead of just for permanent out-takes.
>In any event, the comment is wrong. `*' is a metacharacter for the
>grep program, so the pattern matches lines starting with one or more
>`/'s. "^/\*\*/" is more correct, when such comments are not indented.
Well, obviously you understood what I meant, but your escapes are actually
just as correct as mine (i.e. dead wrong - Ha! I just had to find some nit
to pick in your posting :-). Try grep "^/\\*\\*/"; the shell eats your
unescaped escape.
>Tim McDaniel Applied Dynamics Int'l.; Ann Arbor, Michigan, USA
>Internet: mcdaniel@adi.com UUCP: {uunet,sharkey}!amara!mcdaniel
- Tim Iverson
uunet!xstor!iverson
Technical Details
Message-ID:
<1990Dec29.095119.2206@bang.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!xstor!bang!iversonReferences:
<26036@uflorida.cis.ufl.EDU> <1990Dec27.215842.23685@ivy.uucp> <MCDANIEL.90Dec28110944@dolphin.adi.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!xstor!bang!iverson From: iverson@bang.uucp (Superuser) Newsgroups: comp.std.c Subject: Re: comment style Message-ID: <1990Dec29.095119.2206@bang.uucp> Date: 29 Dec 90 09:51:19 GMT References: <26036@uflorida.cis.ufl.EDU> <1990Dec27.215842.23685@ivy.uucp> <MCDANIEL.90Dec28110944@dolphin.adi.com> Organization: House of the Smoking Gun Lines: 42