tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: (b)make: selecting every other element from a list
On Thu, Sep 03, 2015 at 06:37:32PM +0200, Edgar Fu? wrote:
> Thanks.
>
> > l2:=
> Any particular reason for using := and not = in this place?
No -- the difference is in how the right-hand-side is treated and when
it's empty there's not much in it. However, in general loop stuff
requires := to substitute immediately; otherwise you get the last
value of the loop inserted N times.
> > .for _i _j in $(l)
> > l2+=$(_i)
> > .endfor
>
> Oops. I was sure this didn't work in older (NetBSD 4.0.1) versions
> of (b)make, but I just checked it does work. I (wrongly) remembered
> this ending up in l2 being ${_i} ${_i} ${_i} after the loop, and
> subsequent expansion of ${l2} repeating the last value ${_i}?was
> set to. Strange.
Many loop things don't work, or work only if just so and not in other
forms one would thing would be equivalent.
One of these days it should all be reformed :-(
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index