[comp.lang.c] Comemnts are white space

browns@iccgcc.decnet.ab.com (Stan Brown) (02/05/91)

In article <12924@wraxall.inmos.co.uk>, nathan@elberton.inmos.co.uk (Nathan Sidwell) writes:
> Well gcc -ansi doesn't, 
> source is
> 
> #define NUM -10
> main()
> {
>   int x;
>   x = x-NUM;
>   x = 1/**/2;
> }
> 
> preprocessor output is
> 
> main()
> {
>   int x;
>   x = x--10;
>   x = 1 2;
> }
> 
> which fails, note that it is partly correct as
> the /**/ has been reduced to a space. This is gcc 1.36, has it been
> fixed in later versions?

Comments are _supposed_ to reduce to spaces in ANSI C.  There's no error
to 'fix'.

Standard pg 19 lines 37 ff (sec 3.1):  "Preprocessing tokens can be
separated by _white space_; this consists of comments (described later),
or _white-space characters_ (space, horizontal tab, new-line, vertical
tab, and form-feed), or both."

Standard pg 6 lines 31 ff (sec 2.1.1.2, Translation Phases): "The source
file is decomposed into preprocessing tokens and sequences of
white-space characters (including comments)."

Hey--this is all my opinion, nobody else's. Rely on it at your peril.
                                   email: browns@iccgcc.decnet.ab.com
Stan Brown, Oak Road Systems, Cleveland, Ohio, USA    +1 216 371 0043