> That's what I did at first, but I forgot the exact reason why I changed
> it :P I probably found kind of wasteful to call putchar() for every
> character, but then again, it probably doesn't matter since arguments
> for printf usually aren't that long.
Remember that putchar is a macro, and it only stores a char in an
array and does a comparation (from k&r):
#define putc(x,p) (--(p)->cnt >= 0 \
? (unsigned char) * (p)->ptr++ = (x) : _fillbuf(p))
It is cheap and I think the code is far clear with that aproach.
Regards,
--
Roberto E. Vargas Caballero
Received on Thu Dec 19 2013 - 14:56:38 CET