preprocessor/1890: macro evaluation order prevents termination
Zack Weinberg
zackw@stanford.edu
Sun Apr 1 00:00:00 GMT 2001
The following reply was made to PR preprocessor/1890; it has been noted by GNATS.
From: "Zack Weinberg" <zackw@stanford.edu>
To: b.i.mills@massey.ac.nz
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/1890: macro evaluation order prevents termination
Date: Tue, 6 Feb 2001 12:45:43 -0800
On Tue, Feb 06, 2001 at 08:02:37PM -0000, b.i.mills@massey.ac.nz wrote:
>
> cpp appears to expand macro arguments first, and then the
> macro.
Correct.
> The result is that some macros don't terminate which did terminate
> in earlier versions of cpp that I have used. If outer-most-complete
> macro expansion is used then the behaviour is cleaner and more
> general.
Sorry. The macro expansion algorithm is specified by the C standard
and will not change.
> Eg: if leftmost syntactically correct macro is expanded, and then
> the line is re-read the problem does not occur. I was going to use
> the cpp to demonstrate some properties of macro expansion to my
> class, but the version I have seems to be no good for this.
I suggest you use M4 instead.
zw
More information about the Gcc-prs
mailing list