Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!orchid!jagardner From: jagardner@orchid.UUCP Newsgroups: comp.lang.c Subject: Re: ANS C Macro Processing Message-ID: <11323@orchid.waterloo.edu> Date: Thu, 22-Oct-87 19:56:26 EDT Article-I.D.: orchid.11323 Posted: Thu Oct 22 19:56:26 1987 Date-Received: Sat, 24-Oct-87 14:36:41 EDT References: <167@sdti.UUCP> Reply-To: datanguay@watbun.waterloo.edu (David Tanguay) Organization: U. of Waterloo, Ontario Lines: 40 In article <167@sdti.UUCP> turner%sdti@harvard.harvard.edu (Prescott K. Turner, Jr.) writes: }in the context of #define z +y } #define y(b) z } #define f(a) f(a(3)) }start with } f(z) } identify invocation f(z) } process argument } z } identify invocation z } replace z } +y } rescan, with definition of z suppressed } replace f(z) } f(+y(3)) } rescan, with definition of f suppressed } identify invocation y(3) } process argument } 3 } replace y(3) } f(+z) } rescan starting at "+", with definitions of f and y suppressed } identify invocation z } replace z } f(++y) } rescan, starting at 2nd "+", with definitions of f, y, and z suppressed } f(++y) }done Just a little point about the above: The result is displayed as "f(++y)", but at no point was a single "++" token ever generated. The question I have is whether rescanning implies that preprocesing tokens are converted back into text and re-lexed when rescanned. The difference is whether the above represents the token sequence "f" "(" "++" "y" ")" or the sequence "f" "(" "+" "+" "y" ")". I think that the tokens are lexed once, and that the latter sequence is the correct result, but I don't think I could make a good case for it (or rather, a good case forbidding the other). David Tanguay, Software Development Group, University of Waterloo