Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!iuvax!pur-ee!uiucdcs!uxc.cso.uiuc.edu!ccvaxa!aglew From: aglew@ccvaxa.UUCP Newsgroups: comp.lang.c Subject: Re: #if inside #define -- easy to do, b Message-ID: <28700020@ccvaxa> Date: Fri, 2-Oct-87 20:44:00 EDT Article-I.D.: ccvaxa.28700020 Posted: Fri Oct 2 20:44:00 1987 Date-Received: Wed, 7-Oct-87 03:14:03 EDT References: <157@decvax.UUCP> Lines: 41 Nf-ID: #R:decvax.UUCP:157:ccvaxa:28700020:000:1229 Nf-From: ccvaxa.UUCP!aglew Oct 2 19:44:00 1987 >rbutterworth@orchid.waterloo.edu >In article <29339@sun.uucp>, david@sun.uucp (David DiGiacomo) writes: >> In article <157@decvax.UUCP> minow@decvax.UUCP (Martin Minow) writes: >> >From time immemorial, C has forbidden # control lines inside a >> >macro definition. >> It would be a nice feature to have, but it's not really necessary for your >> example > >OK, here's a real example where it would be useful >(in fact I can't see any nice way of doing this without the ability): > > #if !defined(compiler_A) > #if !defined(compiler_B) > #if !defined(compiler_C) > ^%$%^#^%$&^% syntax error since we don't know this compiler. > > #else /* compiler_C */ > # define ARGSUSED /*ARGSUSED*/ > #endif /* compiler_C */ > > ... Not the subject of this discussion (although I would like to have a real macro language standard for cpp), but the construct above shows the importance of (1) the #elif construct, and (2) a need for a standard abort-compilation construct: #if defined(compiler_A) .. #elif defined(compiler_B) .. #elif defined(compiler_C) .. #else #abort Don't know this compiler - can't define AGSUSED #endif I thibk it was Whitesmith's C that had the #abort construct, and it was very useful.