|
From: | Sam Steingold |
Subject: | Re: iterating over arguments |
Date: | Mon, 14 Sep 2009 16:20:02 -0400 |
User-agent: | Thunderbird 2.0.0.22 (X11/20090625) |
Eric Blake wrote:
Sam Steingold <sds <at> gnu.org> writes:(drop m4_popdef, replace m4_pushdef with m4_define)m4_pushdef/m4_popdef is nicer than m4_define, in that your use of the macro name becomes a local variable (you aren't corrupting state if anything else in the configure.ac happened to use the same name for an unrelated macro). But m4_define works all right if you have no reason to suspect that the macro name will ever collide.
interesting. I thought that I was modifying a local variable. e.g., (defun foo (bar) (setq bar (1+ bar)) ; modify a local binding; no effect outside of foo (print bar)) [1]> (defparameter bar 1) BAR [2]> (defun foo (bar) (incf bar) (print bar)) FOO [3]> bar 1 [4]> (foo 10) 11 11 [5]> bar 1 [6]> you appear to imply that m4_foreach_w([cl_feat], [$1], [ m4_define([cl_feat], ...) ]) leaks cl_feat outside of m4_foreach_w?
m4_foreach_w([cl_feat], [$1], -[m4_pushdef([CL_FEAT], m4_toupper(cl_feat))dnl -AC_CACHE_CHECK([for CL_FEAT in CLISP], [cl_cv_clisp_]cl_feat, +[m4_define([cl_feat], m4_toupper(cl_feat))dnl +AC_CACHE_CHECK([for cl_feat in CLISP], [cl_cv_clisp_]cl_feat,But if you are ALWAYS going to use the upper case version, then why not skip the m4_define altogether and do the upper-casing up front?m4_foreach_w([cl_feat], m4_toupper([$1]), [AC_CACHE_CHECK([for cl_feat in CLISP], ....
even better! will use this! Thanks a lot!
[Prev in Thread] | Current Thread | [Next in Thread] |