comment style
    Sean Eric Fagan 
    sef at kithrup.COM
       
    Sun Jan  6 06:43:21 AEST 1991
    
    
  
In article <1991Jan04.164355.15674 at sco.COM> ron at scocan.sco.COM (Ron Irvine) writes:
>The actual program that contained this problem was very complex.
>It took two of us a day to figure out what had happened.
I would have run it through the preprocessor to figure out what was going
on.  Shouldn't have taken too long.
>The // comment style should have been adopted by the ANSI committee
>if for no other reason that to reduce the likelihood of a programmer
>falling into this horrendous trap. If // style comments had been
>used in the above program the compile would have failed.
Fine.  Please show me an existing C compiler that handles this.  Please tell
me how you are going to handle
	// we want to see if the character is a \
	if (c == '\\')
Is the if statement part of the comment, or not?  In C comments, no
characters are special.  /lib/cpp says that
	/*
	This is a comment?
	/\
	*
results in an unterminated comment, while msc and gcc both accept it.
X3J11's job was to standardize *C*, not change it.  They added trigraphs,
and nobody is happy with them.  They added prototypes, and people like them.
They added noalias, and god himself (dmr 8-)) bore his wrath down upon them.
I know of only one C compiler that accepts //-style comments:  Microsoft C,
versions 5.0 and later.
-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef at kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.
    
    
More information about the Comp.std.c
mailing list