Comment Syntax

Henry Spencer henry at zoo.toronto.edu
Wed Nov 14 04:53:13 AEST 1990


In article <48.UUL1.3#5077 at aussie.COM> rex at aussie.COM (Rex Jaeschke) writes:
>Let me suggest that you CANNOT add // comments to an ANSI C compiler 
>WITHOUT some hacking. Consider the following example:
>
>int i;	// this comment ends in a backslash \
>int j;
> ...
>So, for a future version of ANSI C to adopt //, they would have to 
>either rearrange the phases of translation (unlikely since that would 
>no longer be backwards compatible) or to treat // and /**/ comments 
>differently and add a new phase for //.

Um, why?  In ANSI C, this program fragment is illegal -- a syntax error --
and the standard does not constrain responses to syntax errors.  If //
comments were added, some programs that are now syntactically erroneous
would become legal, but that is true of many types of extension.  I don't
see the problem.
-- 
"I don't *want* to be normal!"         | Henry Spencer at U of Toronto Zoology
"Not to worry."                        |  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.std.c mailing list