Thread (1 message) 1 message, 1 author, 2011-10-05
  • (off-list ancestor, not in this archive)
  • Re: printf 3 · Michael Kerrisk <hidden> · 2011-10-05

Re: printf 3

From: Michael Kerrisk <hidden>
Date: 2011-10-05 04:39:48

Possibly related (same subject, not in this thread)

On Wed, Oct 5, 2011 at 2:04 AM, Jon Grant [off-list ref] wrote:
Michael Kerrisk wrote, On 04/10/11 06:46:
quoted
Hi Jon,

On Tue, Oct 4, 2011 at 1:58 AM, Jon Grant[off-list ref]  wrote:
quoted
Hello

Looking at this page:
http://man7.org/linux/man-pages/online/pages/man3/printf.3.html

"If an output error is encountered, a negative value is returned."

I am thinking if this could be clarified. If I call printf(NULL), errno
is
set to EINVAL, and -1 is returned.

Perhaps could be expanded to add:

"If a parameter error is encountered, errno set to EINVAL, and -1 is
returned. If an output error is encountered, errno set EIO and -1
returned.
The apparently vague wording is deliberate. Glibc may generally return
-1, but POSIX simply says "a negative value", and that's all that is
guaranteed to an application.
Ah ok. Good point.

Is it worth documenting the Glibc behaviour on the man page in addition to
explaining POSIX spec.
I don't think so in this case. It would mislead people into writing
less portable code.

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help