On Wed, Sep 15, 2010 at 12:01:00PM +0200, Alessandro Rubini wrote:
> But putchar and fwrite cannot evaluate the arguments more than once.
> So the patch is fine for putc (the part I don't quote here), but
> is wrong (i.e., unneeded) for the two hunks above.

OpenWatcom for one, defines putchar() as a macro in some configurations,
so there, at at least, it's not wrong. I changed the fwrite() loop only
for consistency with the putc() loop immediately below.

> If a library implementation has double evaluation for putchar and
> fwrite, it's the library that's broken; I think we don't special-case
> for broken tools, at least not without making a comment.  Or do we
> want to remove all ++ and -- because functions may be broken?

There was only one instance of putchar() that was affected by this in
the entire Busybox source code, and it was failing in at least one
environment, so I changed it. The current form is equivalent and works
just as well as the old, with (presumably) no binary size impact. "Wrong"
is perhaps too harsh a description.

>>> Dan
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to