Article View: comp.std.c
Article #4756Re: Are macros expanded within unused macro arguments?
From: Norman Diamond
Date: Mon, 05 Feb 1996 03:07
Date: Mon, 05 Feb 1996 03:07
38 lines
2513 bytes
2513 bytes
In article <4esiem$bbr@info.epfl.ch>, Thomas.Wolf@di.epfl.ch (Thomas Wolf) writes: >In article <4es8rp$98n@usenet.pa.dec.com>, diamond@tko.dec.com (Norman Diamond) writes: >>In article <TANMOY.96Feb1102025@qcd.lanl.gov>, tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) writes: >>>In article <DM3MC3.Atv@scr.siemens.com> mlg@scr.siemens.com (Michael Greenberg) writes: >>>>Is the following program legal? >>>>#define foo(unused) >>>>#define bar(x,y) >>>>foo(bar(1)) >>>I read it as being legal. >>Mr. Bhattacharya, I am shocked. >Mr. Diamond, why are you shocked? Macro 'bar' is not invoked. Now I see the point you are trying to make, but do not see any proof. Consider 6.8.3 itself (ANSI Classic 3.8.3 page 90 lines 35 to 37): "Each subsequent instance of the function-like macro name followed by a ( as the next preprocessing token introduces the sequence of preprocessing tokens that is replaced by the replacement list in the definition (an invocation of the macro)." No exception or delay is suggested on account of being an argument of a different macro. 6.8.3.1 prevents a delay from being too long (in cases where the replacement would be used in the outer replacement) but does not do the opposite. Hmm, I can see that this might be another defect in the standard, because it says that even the following definition of glitch will invoke bar: #define glitch bar(1) even if no other instance of glitch or bar occurs at all in the translation. However, this instance of the defect is somewhat more obvious than in the preceding case. Perhaps the question cannot be answered at all until the standard is corrected. -- << If this were the company's opinion, I would not be allowed to post it. >> "I paid money for this car, I pay taxes for vehicle registration and a driver's license, so I can drive in any lane I want, and no innocent victim gets to call the cops just 'cause the lane's not goin' the same direction as me" - J Spammer
Technical Details
Message-ID:
<4f3sa2$8ue@usenet.pa.dec.com>Path:
arc1-ca.pugleaf.net!tko.dec.com!diamondReferences:
<DM3MC3.Atv@scr.siemens.com> <TANMOY.96Feb1102025@qcd.lanl.gov> <4es8rp$98n@usenet.pa.dec.com> <4esiem$bbr@info.epfl.ch>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!tko.dec.com!diamond From: diamond@tko.dec.com (Norman Diamond) Newsgroups: comp.std.c Subject: Re: Are macros expanded within unused macro arguments? Date: 5 Feb 1996 03:07:45 GMT Organization: Digital Equipment Corporation Japan , Tokyo Message-ID: <4f3sa2$8ue@usenet.pa.dec.com> References: <DM3MC3.Atv@scr.siemens.com> <TANMOY.96Feb1102025@qcd.lanl.gov> <4es8rp$98n@usenet.pa.dec.com> <4esiem$bbr@info.epfl.ch> Reply-To: diamond@jrdv04.enet.dec-j.co.jp (Norman Diamond) NNTP-Posting-Host: jit533.tko.dec.com