Article View: comp.std.c
Article #99Re: preprocessing subterfuge
From: Larry Jones
Date: Sat, 08 Aug 1992 21:30
Date: Sat, 08 Aug 1992 21:30
20 lines
1121 bytes
1121 bytes
In article <1992Aug7.001510.13418@mri.com>, woolsey@mri.com (Jeff Woolsey) writes:
> Basically, is the following module legal?
>
> #define it 1,2
> #define that(a,b) a+b
>
> void f(void) {
> that(it);
> }
No -- the C police will be showing up any minute now to take you away.
The macro "that" is being called with the wrong number of arguments.
The single argument would expand into a sequence of characters that
includes a comma, but it is still a single argument. Recognition of
a function-like macro invocation and identification of the arguments
takes place before the arguments themselves are macro replaced.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070
Domain: lawrence.jones@sdrc.com IBMMAIL: USSDR7DR at IBMMAIL
We seem to be out of gun powder. -- Calvin
Technical Details
Message-ID:
<1949@sdrc.COM>Path:
arc1-ca.pugleaf.net!sparky!uunet!sdrc!thor!scjonesReferences:
<1992Aug7.001510.13418@mri.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!sdrc!thor!scjones From: scjones@thor.sdrc.com (Larry Jones) Newsgroups: comp.std.c Subject: Re: preprocessing subterfuge Message-ID: <1949@sdrc.COM> Date: 8 Aug 92 21:30:32 GMT References: <1992Aug7.001510.13418@mri.com> Sender: news@sdrc.COM Lines: 20