🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1965

Re: Comment Syntax

#1965
From: Rex Jaeschke
Date: Sat, 10 Nov 1990 00:51
37 lines
1745 bytes
> In article <HAGERMAN.90Nov7193212@rx7.ece.cmu.edu> 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;

and the declaration of j would be treated as part of the comment.

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 //.

Rex

----------------------------------------------------------------------------
Rex Jaeschke     |  Journal of C Language Translation  | C Users Journal
(703) 860-0091   |        2051 Swans Neck Way          | DEC PROFESSIONAL
uunet!aussie!rex |     Reston, Virginia 22091, USA     | Programmers Journal
----------------------------------------------------------------------------
Convener of the Numerical C Extensions Group (NCEG)
----------------------------------------------------------------------------
Technical Details
Message-ID: <48.UUL1.3#5077@aussie.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aussie!rex
References: <14390@smoke.brl.mil>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!aussie!rex
From: rex@aussie.COM (Rex Jaeschke)
Newsgroups: comp.std.c
Subject: Re: Comment Syntax
Message-ID: <48.UUL1.3#5077@aussie.COM>
Date: 10 Nov 90 00:51:50 GMT
References: <14390@smoke.brl.mil>
Organization: Journal of C Language Translation
Lines: 37