Re: m4_foreach_w vs m4_foreach

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

 





On Wed, 4 Jul 2012, Eric Blake wrote:

On 07/04/2012 12:58 AM, Vincent Torri wrote:


On Mon, 2 Jul 2012, Eric Blake wrote:

Not directly with a single m4_foreach_w, but it would be possible with
other macro constructs.  Note that m4 is better suited for
comma-separated lists instead of whitespace-separated lists,

when you say 'better suited', you mean faster ?

Yes.  m4_foreach_w is more or less a wrapper that converts spaces into
commas, then calls m4_foreach on the comma-separated result.  Starting
with comma-separated lists in the first place can use native m4 handling
rather than having to do under-the-hood conversions.


I ask because I used a simple macro that uses m4_foreach_w. Should I use
m4_foreach instead ?

That all depends on the syntax you want your users to be aware of.
There are some cases where whitespace-separated lists are easier for
users to type.  Furthermore, in autoconf particularly, there is a
benefit to using whitespace separation when you are interacting with
shell code output (for example, having the flexibility to write 'for i
in $1; do', but also do m4 processing on each element of $1).  In other
words, the trade-off between m4 speed and ease of use is not always trivial.

as I'm the maintainer of the autotools, I use the syntax I want. I just want to call m4 macro for all the tokens, so using a comma separated list is fine.

thank you

Vincent Torri

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux