Article View: net.lang.c++
Article #164Re: System V preprocessor problem with <generic.h>
From: R.B.Murray
Date: Fri, 02 May 1986 17:19
Date: Fri, 02 May 1986 17:19
32 lines
1704 bytes
1704 bytes
> In article <3597@sun.uucp> sun!guy (Guy Harris) writes: > >> #define name2(a,b) a/**/b > >It has, however, two problems: > > > > 1) If you run your code through "lint", it won't work > > I tried this example with "cpp -C" and it worked fine. I'd guess that > cpp strips all comments in preprocessor directives regardless of "-C". > > > 2) It is not a guaranteed property of the C language, but a > > quirk of the implementation, so it will not work in > > general. > > Agreed. Any application that depends on being able to do this is treading > on thin ice. > > Karl W. Z. Heuer (ihnp4!bentley!kwh), The Walking Lint Agreed also. I also don't believe there is a standard and portable way to do this at the present time. However, the current draft of the ANSI C standard has an "offical" way to do this: #define name2(a,b) a##b The "##" is a (new) concatenation operator. Of course, this is only useful once a standard exists and everybody conforms to it. Also, ANSI may change their minds on the syntax of this feature. Rob Murray AT&T Summit, NJ
Technical Details
Message-ID:
<246@sfsup.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!mhuxm!sftig!sfsup!rbmReferences:
<3597@sun.uucp> <779@bentley.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site sfsup.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!mhuxm!sftig!sfsup!rbm From: rbm@sfsup.UUCP (R.B.Murray) Newsgroups: net.lang.c++,net.lang.c Subject: Re: System V preprocessor problem with <generic.h> Message-ID: <246@sfsup.UUCP> Date: Fri, 2-May-86 13:19:51 EDT Article-I.D.: sfsup.246 Posted: Fri May 2 13:19:51 1986 Date-Received: Sat, 3-May-86 20:24:52 EDT References: <3597@sun.uucp> <779@bentley.UUCP> Organization: AT&T Information Systems, Summit N.J. Lines: 32