🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2281

Re: comment style

#2281
From: Ron Irvine
Date: Tue, 08 Jan 1991 16:40
33 lines
1754 bytes
> In article <1991Jan04.164355.15674@sco.COM> ron@scocan.sco.COM (Ron Irvine) writes:
> >	a = 100/*p	/* calculate first factor */
> >I have run this program on 4 different C compilers and none of them
> >even warned of a potential problem (nested comments).
> 
> Four different compilers, or four different ports of the same compiler?
> (Many Unix C compilers are really the same one, good [?] old PCC.)  An
> alert compiler *will* warn about this.
> 
> Henry Spencer at U of Toronto Zoology

The four compilers:  gcc 1.38 on a 386, SCO/Microsoft C 386, AT&T C 386,
and Turbo C++/C on DOS.  Four very different compilers.

  |-----------------
  | ANSI C Section 3.1.9 Comments:
  | 
  |       Except within a character constant, a string literal, or a
  | comment, the characters /* introduce a comment.  The contents of
  | a comment are examined only to identify multibyte characters
  | and to find the characters */ that terminate it. 26
  | 
  | 26. Thus, comments do not nest.
  |----------------

Thus, a compiler that gives a warning of nested comments upon
finding the characters /* within a comment must have "examined"
the contents of the comment beyond that specified by the standard
and is in violation of the standard.  So, the four compilers I used
were in fact processing the code correctly and were correct in not
producing a warning.

Ron Irvine, ron@sco.com
Technical Details
Message-ID: <1991Jan08.164014.26804@sco.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!ncrcan!scocan!ron

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!ncrcan!scocan!ron
From: ron@scocan.sco.COM (Ron Irvine)
Newsgroups: comp.std.c
Subject: Re: comment style
Message-ID: <1991Jan08.164014.26804@sco.COM>
Date: 8 Jan 91 16:40:14 GMT
Sender: news@sco.COM (News administration)
Organization: SCO Canada, Inc. (formerly HCR Corporation)
Lines: 33
Originator: ron@capri