Re: [dwm] Re: [PATCH] fprintf where fputs is sufficiant

From: Matthias-Christian Ott <ott_AT_mirix.org>
Date: Sun, 15 Feb 2009 19:53:22 +0100

On Sun, Feb 15, 2009 at 07:43:47PM +0100, Szabolcs Nagy wrote:
> On 2/15/09, Marcin Cieslak <saper_AT_system.pl> wrote:
> > Enno "Gottox" Boland <gottox_AT_gmail.com> wrote:
> >> - fprintf(stderr, "warning: no locale support\n");
> >> + fputs("warning: no locale support\n", stderr);
> >
> > Depends on a code style one likes. To quote FreeBSD's style(9):
> >
> > Use printf(3), not fputs(3), puts(3), putchar(3), whatever; it is
> > faster
> > and usually cleaner, not to mention avoiding stupid bugs.
>
> yes, depends on who you ask, from dietlibc FAQ:
>
> Q: When linking binaries, I get warnings about stdio and printf all the
> time. What gives?
> A: Since the diet libc was written to make writing small programs
> possible, it also tries to assist in the process of seeing causes of
> bloat. Premier causes for bloat are stdio and the printf family of
> functions...

But in dietlibc puts() is a write() wrapper (so it does no buffering),
in glibc puts() is part of stdio and thus uses stdout.

Regards,
Matthias-Christian
Received on Sun Feb 15 2009 - 18:53:22 UTC

This archive was generated by hypermail 2.2.0 : Sun Feb 15 2009 - 19:12:04 UTC