home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / next / programm / 5733 < prev    next >
Encoding:
Text File  |  1992-08-21  |  1.3 KB  |  39 lines

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