autoconf-patches
[Top][All Lists]
Advanced

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

Re: document m4_foreach*/AC_FOREACH


From: Eric Blake
Subject: Re: document m4_foreach*/AC_FOREACH
Date: Thu, 16 Feb 2006 14:08:12 -0700
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Ralf,

According to Ralf Wildenhues on 2/16/2006 1:58 PM:
>>m4_for([myvar], 1, 1, 0, [ myvar])
> 
> Yes, good idea.  Below is an additional patchlet for the first and third
> case.  The second isn't m4_assert'ed at the moment: the body is expanded
> once, with myvar set to 1.  Do you think that should be forbidden?  I'm
> not sure that would be necessary.  My concerns were mostly with (almost)
> endless loops and huge memory consumption, which may happen if the user
> inadvertently messes up.

I guess you have a point there, since step is irrelevant if first == last.
 The only reason to forbid it would be if the user would reasonably expect
an infinite loop, even though we are shortcutting to only execute the loop
once.  But like you said, the user should never reasonably expect an
infinite loop, so I think allowing the optimization of ignoring step when
the bounds are equal, even if step was 0, is okay.  Either way, the
testsuite needs to explicitly test the chosen behavior, so that we cannot
accidentally regress in the future (even though we never anticipate a user
coding up m4_for([myval], 1, 1, 0, [ myval]), we can't be too careful).

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFD9Om784KuGfSFAYARAl+lAKDNuvfdXWIssVsOiKmBa6Kf+hWuOgCfeJZk
1LEhDiLQ2rfM8SUPTTwW0BQ=
=JVON
-----END PGP SIGNATURE-----




reply via email to

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