This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Traditional macro recursion


On Wed, Jun 05, 2002 at 09:13:22PM +0100, Neil Booth wrote:
> Zack, I remember you had an example of a traditional macro
> expansion including the macro name but that didn't recurse.
> I kind find it any more; I recall it as being one of the ISO
> tests in the testsuite though.  Could you remind me what it
> was?  I'm trying to come up with a foolproof way of detecting
> recursion without waiting till the 200th expansion to find out.

The only example I know of is from cccp.c (look in a 2.95 tree):

    /* Recursive macro use sometimes works traditionally.
       #define foo(x,y) bar (x (y,0), y)
       foo (foo, baz)  */

This presumably expands first to

  bar (foo (baz, 0), baz)

and then

 bar (bar (baz (0, 0), baz), baz)

This comment was in some part of cpplib, too, until I ripped out the
old traditional support.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]