Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!abvax!iccgcc!browns From: browns@iccgcc.decnet.ab.com (Stan Brown) Newsgroups: comp.lang.c Subject: Comemnts are white space (was re: #define THING -10) Message-ID: <3078.27ad59ab@iccgcc.decnet.ab.com> Date: 4 Feb 91 17:55:07 GMT References: <33@christmas.UUCP> <14998@smoke.brl.mil> <12924@wraxall.inmos.co.uk> Lines: 40 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