home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.next.programmer
- Path: sparky!uunet!usc!sdd.hp.com!mips!darwin.sura.net!Sirius.dfn.de!zrz.tu-berlin.de!cs.tu-berlin.de!jutta
- From: jutta@opal.cs.tu-berlin.de (Jutta Degener)
- Subject: Re: Can C preprocessor handle #include "fooa" "foob"
- Message-ID: <1992Aug21.145451.17901@cs.tu-berlin.de>
- Followup-To: comp.lang.c
- Sender: news@cs.tu-berlin.de
- Organization: Techn. University of Berlin, Germany
- References: <1992Aug20.235325.18290@cco.caltech.edu>
- Date: Fri, 21 Aug 1992 14:54:51 GMT
- Lines: 26
-
- ernest@pundit.cithep.caltech.edu (Ernest Prabhakar) writes:
- > There is a funky trick which works under the 3.0 NeXT preprocessor, but not
- > under GNU 2.1 or 2.2. It is:
- > #include "string1" "string2"
- [..]
- > Does stringification take place before includes? Then GNU is broken.
- > Is it the other way around? Then NeXT's preprocessor supplies (and
- > thus NeXT include files rely upon) non-standard behavior.
-
- GNU's right, this trick is just too funky for ANSI C.
-
- String concatenation takes place in translation phase 6, when
- the inclusions (which are done in phase 4) have long since
- happened.
-
- The ANSI thing to do would be to glue identifiers, not strings,
- and stringize them afterwards:
-
- #define stringize(a) #a
- #define glue(base, version) stringize(base ## version)
-
- #include glue(fish, 2.1.1.2)
-
- Followups to comp.lang.c.
-
- -Jutta
-