Article View: comp.std.c
Article #142Re: preprocessing subterfuge
From: Murray Nesbitt
Date: Tue, 11 Aug 1992 04:20
Date: Tue, 11 Aug 1992 04:20
47 lines
2021 bytes
2021 bytes
steve@taumet.com (Steve Clamage) writes:
>mjn@pseudo.uucp (Murray Nesbitt) writes:
>
>>My advice? Two minutes with a compiler would have saved you an
>>afternoon with the Standard.
>
>This is comp.STD.C, intended for discussions about what the Standard says.
You're right. And neither one of us answered his question. Here's
the original code snippet:
#define it 1,2
#define that(a,b) a+b
void f(void) {
that(it);
}
The Standard (Section 3.8.3) says:
The number of arguments in an invocation of a function-like macro
shall agree with the number of parameters in the macro definition
[...].
This seems clear enough to me, but just in case there remains any
ambiguity regarding the order in which the argument substitutions take
place, the Standard (Section 3.8.3.1) says:
After the arguments for the invocation of a function-like macro
have been identified, argument substitution takes place. A
parameter in the replacement list [...] is replaced by the
corresponding argument after all macros contained therein have
been expanded.
>Apart from that, suppose a compiler accepts some construct. Does that
>mean the construct is Standard-conforming? If the compiler rejects it,
>is the construct illegal?
Is this a trick question, Steve?
At any rate, in the context of comp.std.c, I see your point.
Murray
--
Until my site's in the maps, please reply to "druid!pseudo!mjn".
Technical Details
Message-ID:
<MJN.92Aug10202042@pseudo.uucp>Path:
arc1-ca.pugleaf.net!sparky!uunet!wupost!usc!rpi!utcsri!torsqnt!lethe!druid!pseudo!mjnReferences:
<1992Aug7.001510.13418@mri.com> <MJN.92Aug9024600@pseudo.uucp> <1992Aug9.144525.4521@taumet.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!usc!rpi!utcsri!torsqnt!lethe!druid!pseudo!mjn From: mjn@pseudo.uucp (Murray Nesbitt) Subject: Re: preprocessing subterfuge Organization: Private system in Toronto, ON Date: Tue, 11 Aug 1992 04:20:42 GMT Message-ID: <MJN.92Aug10202042@pseudo.uucp> In-Reply-To: steve@taumet.com's message of Sun, 9 Aug 1992 14:45:25 GMT References: <1992Aug7.001510.13418@mri.com> <MJN.92Aug9024600@pseudo.uucp> <1992Aug9.144525.4521@taumet.com> Sender: mjn@pseudo.uucp (Murray Nesbitt) Lines: 47