home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!stanford.edu!leland.Stanford.EDU!dhinds
- From: dhinds@leland.Stanford.EDU (David Hinds)
- Subject: Re: Bug in /usr/lib/cpp ?
- Message-ID: <1992Sep11.192707.25285@leland.Stanford.EDU>
- Sender: news@leland.Stanford.EDU (Mr News)
- Organization: DSG, Stanford University, CA 94305, USA
- References: <stefans.716210195@bauv106> <1992Sep11.183618.25338@odin.corp.sgi.com>
- Date: Fri, 11 Sep 92 19:27:07 GMT
- Lines: 39
-
- In article <1992Sep11.183618.25338@odin.corp.sgi.com> ciemo@bananapc.csd.sgi.com (Dave Ciemiewicz) writes:
- >In article <stefans.716210195@bauv106>, stefans@bauv106.bauv.unibw-muenchen.de (Stefan Schwarz) writes:
- >|> #define Concat(a,b) a/**/b
- >|> filename: /usr/lib/Concat(lib,X11.a)
- >|>
- >|> cpp produces: filename: /usr/lib/ libX11.a
- >|> ^extra space
- >|> I can't avoid this extra space!
- >|>
- >|> acpp doesn't do this, but for several reasons i cannot switch to acpp.
- >
- >Changing /**/ to a space is a feature of acpp, not cpp.
-
- The concatenation is not the issue here.
-
- #define X(a) a
- filename: /usr/lib/X(libX11.a)
-
- produces with cpp:
-
- filename: /usr/lib/ libX11.a
-
- The problem seems to be that with IRIX /usr/lib/cpp, macros that take
- arguments always introduce a leading space when they are expanded, but
- macros without arguments do not add the space. This isn't normally a
- problem, because white space between tokens is not significant in C;
- this is a special case, because here the macro expansion is being done
- within something meant to later be a single token, sort of by tricking
- the preprocessor to treat the whole filename as several tokens for the
- purpose of macro expansion. I'm not sure if this is supposed to be
- well-defined or not.
-
- Anyway, the way to avoid the problem is to use acpp in '-traditional'
- mode, which seems to be a "better" K&R preprocessor than regular cpp.
- Compile with 'cc -Wp,-traditional' to get this.
-
- - David Hinds
- dhinds@allegro.stanford.edu
-
-