Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!mintaka!wald From: wald@theory.lcs.mit.edu (David Wald) Newsgroups: comp.std.c Subject: Re: Comment Syntax Message-ID: <1990Nov13.181856.17322@mintaka.lcs.mit.edu> Date: 13 Nov 90 18:18:56 GMT References: <14390@smoke.brl.mil> <48.UUL1.3#5077@aussie.COM> Sender: daemon@mintaka.lcs.mit.edu (Lucifer Maleficius) Reply-To: wald@theory.lcs.mit.edu (David Wald) Organization: Laboratory for Computer Science, MIT Lines: 31 In article <48.UUL1.3#5077@aussie.COM> rex@aussie.COM (Rex Jaeschke) writes: >> In article hagerman@ece.cmu.edu (John Hagerman) writes: >> >Why didn't // ... newline comments make it into ANSI C? >> > >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; > >f() >{ > i = j; /* error: j is not declared */ >} > >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; How much of a problem would this be? It would mean that \\\n behaves the same in comments as outside them, but that is already the case. What do BCPL or C++ do with a comment like this? -David -- ============================================================================ David Wald wald@theory.lcs.mit.edu ============================================================================