[Top][All Lists]

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

Re: Example code bug

From: Eric Blake
Subject: Re: Example code bug
Date: Sat, 16 Aug 2014 08:39:36 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

On 08/16/2014 08:35 AM, Eric Blake wrote:

> existing:
>> define(`_forloop', `$4'`ifelse($1, `$3', `', `define(`$1',
>> incr($1))$0($@)')')

Oops, I think the bug is on YOUR end, for mis-transcribing what is
already in the manual.  The manual actually says:

       `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')')

Note that it uses "`$4`'ifelse...", where you typed "`$4'`ifelse...".
Where the manual uses `', you incorrectly used '` as the separator
between the parameter expansion and the ifelse macro name.

> proposed:
>> define(`_forloop', `$4'``''`ifelse($1, `$3', `', `define(`$1',
>> incr($1))$0($@)')')
> you are merely adding an empty quote to separate $4 from ifelse.  Which
> seems simple enough to do.  I'll turn it into a formal patch soon enough.

Your proposed text matches what the manual already has, but with more
typing.  Remember, m4 does string concatenation, so it is joining the
strings "$4", "`'", and "ifelse...", for the end result of
"$4`'ifelse..." that matches what the manual already has.  No patch
necessary after all.

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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