[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: POSIX requires checking all *printf return values?!?

From: Bruce Korb
Subject: Re: POSIX requires checking all *printf return values?!?
Date: Mon, 22 Oct 2007 13:40:29 -0700

On 10/19/07, Jim Meyering <address@hidden> wrote:
> > Personally, I would LOVE for the stream error indicator to be reliable
> > after [f]printf failures, even in the face of errors unrelated to
> > fputc()-style actions.  But I don't see that required in the standards,
> > and this thread was started by a libc implementation that did just that -
> > returned -1 for ENOMEM without adjusting ferror().  Is it worth changing
> > POSIX to require ferror() to be reliably set?  Or is it at least worth
> How about *allowing* ferror to be reliably set?

If you can't rely on it, then you can't rely on it and you need to wrap all
*printf calls with excruciatingly correct error condition tests.  Programmers
have learned that you check ferror() for problems.  Now saying that it is
merely "a mostly complete cover" of error conditions basically says it
does not work.  The next rev of C should correct the oversight.
Old (current) environments need the extra code.  Thanks - Bruce

reply via email to

[Prev in Thread] Current Thread [Next in Thread]