Comment Syntax

Walter Bright bright at nazgul.UUCP
Fri Nov 16 07:23:32 AEST 1990


In article <48.UUL1.3#5077 at aussie.COM> rex at aussie.COM (Rex Jaeschke) writes:
/int i;	// this comment ends in a backslash \
/int j;
/ANSI's phases of translation require that backslash/new-lines be 
/processed BEFORE comments. In this case the 2 declaration lines would 
/become:
/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 //.

There was some debate about this on BIX a while back. The consensus seemed
to be that the phases of translation were not modified to support //
comments. If you had a // comment that ended in a \, then the line got
spliced and the next line became part of the comment.

This is not a very onerous burden, if it really bugs someone they could always
use /* */ comments (in macros is where this problem crops up).



More information about the Comp.std.c mailing list