mod.std.c Digest V8#1

Orlando Sotomayor-Diaz osd at hou2d.UUCP
Mon Jul 1 23:51:07 AEST 1985


From: Orlando Sotomayor-Diaz (The Moderator) <cbosgd!std-c>


mod.std.c Digest            Mon,  1 Jul 85       Volume 8 : Issue   1 

Today's Topics:
                 C comments (Section C.1.7) (3 msgs)
----------------------------------------------------------------------

Date: Wed, 26 Jun 85 00:16:48 edt
From: Barry Margolin <packard!harvard!mit-eddie!barmar>
Subject: C comments (Section C.1.7)
To: cbosgd!std-c

In article <566 at hou2d.UUCP> seismo!elsie!ado writes:
>*	Section C.1.7, page 22:
>
>		The contents of a comment are examined only to find the
>		characters */ that terminate it.  Thus comments do not nest.
>
>	and section E.3, page 135, listing "common warnings":
>
>		The characters /* are found in a comment.
>
>	Sorry. . .if you're only allowed to look for the */ that terminates
>	a comment, you can't look for a /*.  Change the first quote to:
>
>		The contents of a comment are examined to find the characters
>		*/ that terminate it.  Comments do not nest.

There is nothing wrong with a compiler generating a warning for a common
typo, although there should be a way to disable it.  The first quote
only implies that the lexical analysis should still treat it as a
comment.  That's why it is a warning, not an error: the program is
valid, but the compiler has reason to be suspicious that the user might
not have meant what he said.

------------------------------

Date: Wed, 26 Jun 85 21:15:03 EDT
From: harvard!seismo!elsie!ado
Subject: C comments (Section C.1.7)
To: mit-eddie!barmar

I certainly agree that allowing compilers to look for potential typos is a
good thing--in fact, the C compiler here on elsie looks for and warns about
"possibly nested comments."  I'd like to keep that behavior without having our
compiler be out of step with the standard.

> The. . .quote only implies that the lexical analysis should still
> treat it as a comment. . .

Now here our views are different.  To me, that "only" in the quote is the key
word--if comments may be examined ONLY to find the */ that terminates them,
then they cannot be examined for purposes of generating warnings.  Which is why
I suggested dropping the "only."

Can folks think of a better wording for the section in question that both gets
across the idea of comments not nesting and avoids disallowing warnings?

				--ado

------------------------------

Date: Thu, 27 Jun 85 03:29:11 edt
From: Barry Margolin <ihnp4!seismo!harvard.ARPA!barmar%mit-eddie.UUCP>
Subject: C comments (Section C.1.7)
To: seismo.ARPA!elsie!ado, seismo.ARPA!harvard!mit-eddie!barmar

Perhaps the section could read something like "for purposes of determining
the meaning of program source, comments may be examined only to find the
*/ ...."  I am not really happy with my wording here, but the idea is that
it should specify that this description applies only to the parse used
to translate the program, but doesn't restrict it from further examining
the comment for other purposes.

I don't have a copy of the standard, so I don't know if this is in there:
the section that suggests warning about a /* found in a quote should
strongly suggest that if this is done then there should be a way to
disable it.  Many shops (for instance, Multics System Development, where
I work) have rules that programs must compile without any errors or
warnings or they will not be installed into the system library.

    Barry Margolin
    ARPA: barmar at MIT-Multics
    UUCP: ..!genrad!mit-eddie!barmar

------------------------------

End of mod.std.c Digest - Mon,  1 Jul 85 09:45:01 EDT
******************************
USENET -> posting only through cbosgd!std-c.
ARPA -> ... through cbosgd!std-c at BERKELEY.ARPA (NOT to INFO-C)
In all cases, you may also reply to the author(s) above.



More information about the Mod.std.c mailing list