Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!csun!kithrup!sef From: sef@kithrup.COM (Sean Eric Fagan) Newsgroups: comp.std.c Subject: Re: comment style Message-ID: <1991Jan05.194321.12428@kithrup.COM> Date: 5 Jan 91 19:43:21 GMT References: <1991Jan04.164355.15674@sco.COM> Organization: Kithrup Enterprises, Ltd. Lines: 40 In article <1991Jan04.164355.15674@sco.COM> ron@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@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.