HP3000-L Archives

March 2003, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Walter Murray <[log in to unmask]>
Reply To:
Walter Murray <[log in to unmask]>
Date:
Sun, 23 Mar 2003 15:02:38 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (34 lines)
 "F. Alfredo Rego" wrote:

> All I can find in c89 references (books and online) regarding the
> "//" single-line comment construct is as terse as
>    "This type of comment begins with // and runs to the end
>     of the line".
> Obviously, there are exceptions and/or other requirements.  Can
> somebody define, explicitly, what such "other requirements and/or
> exceptions" for c's single-line comment are?

The 1989 ANSI C standard does not define //-style comments.  An attempt to
use one with a standard-conforming compiler would typically result in a
diagnostic.  A C compiler may have an option (which might even be the
default) to instruct it to recognize //-style comments, but such a compiler
is not a conforming implementation of the C standard when invoked with that
option.

Here's an example of why a compiler that recognizes //-style comments is not
ANSI-conforming.  Consider the following two-line statement:

     i = 6//*comment*/
          -2;

This is valid C and must result in -3 being stored in i, if the compiler
conforms to the standard.  In a language that recognizes //-style comments,
such as Java, the result will be 4.  The HP C/iX compiler should conform to
the standard.  I don't know what the Gnu compiler does.

Walter
(Not speaking for HP)

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2