comment style

Superuser iverson at bang.uucp
Sat Dec 29 20:51:19 AEST 1990


In article <MCDANIEL.90Dec28110944 at dolphin.adi.com> mcdaniel at adi.com (Tim McDaniel) writes:
>iverson at 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 at adi.com                UUCP: {uunet,sharkey}!amara!mcdaniel

- Tim Iverson
  uunet!xstor!iverson



More information about the Comp.std.c mailing list