Re: [dev] [sbase] printf(1)

From: Roberto E. Vargas Caballero <>
Date: Thu, 19 Dec 2013 14:56:38 +0100

> 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.


Roberto E. Vargas Caballero
Received on Thu Dec 19 2013 - 14:56:38 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 19 2013 - 15:00:07 CET