Path: utzoo!utgpu!watmath!att!pacbell!ames!excelan!ames!sun-barr!cs.utexas.edu!uunet!munnari.oz.au!cs.mu.oz.au!ok From: ok@cs.mu.oz.au (Richard O'Keefe) Newsgroups: comp.lang.c Subject: Re: Concatenating with a compile-time definition in "ANSI" CPP Message-ID: <2292@munnari.oz.au> Date: 4 Oct 89 07:18:33 GMT References: <470004@gore.com> <29351@watmath.waterloo.edu> <17936@pasteur.Berkeley.EDU> Sender: news@cs.mu.oz.au Lines: 16 In article <17936@pasteur.Berkeley.EDU>, hunt@ernie.Berkeley.EDU (Jim Hunt) writes: > You can do this in non ANSI environments (at least Sun) with > #define MyInit(arg) arg/**/Init > which is an ugly hack on the preprocessor, that is also defined > in the ANSI C preprocessor! Yes, the ANSI standard does define the behaviour of arg/**/Init, but it defines it *NOT* to work. In "Reiser" preprocessors, comments got turned into nothing at all. In ANSI preprocessors, comments get turned into one blank. So MyInit(Bogus) would turn into "BogusInit" in a "Reiser" preprocessor, but into "Bogus Init" in an ANSI-conformant one. I have found gcc extremely helpful for coming to grips with things like this; I use "gcc -ansi -pedantic" all the time just to be safe. If my code works under both that and "gcc -traditional" and if "lint" likes it I begin to feel that I may not have overlooked obvious non-portabilities.