bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in M4


From: Paul Eggert
Subject: Re: Bug in M4
Date: Mon, 03 Jan 2005 14:27:58 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"Sam Lauber" <address@hidden> writes:

> I was using GNU M4 1.4.2, and typed in the following recursive additive macro:
>
> define(`add', `ifelse($1, 0, $2, add(decr($1), incr($2))')
>
> I then typed `add(1, 1)'. Obviously, I expected it to say `2', but it said
>
> `Recursion limit of 250 exceeded; use -L<N> to change'
>
> I consider this a bug, because though this _is_ a recursive alogrithm,
> I don't think it would recurse 250 times over adding 1 + 1.

You didn't quote correctly.  Try this:

define(`add', `ifelse($1, 0, $2, `add(decr($1), incr($2))')')

M4 quoting is a bit arcane; you have to get into the macro-processor
mindset.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]