public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* printf 3
@ 2011-10-03 23:58 Jon Grant
       [not found] ` <4E8A4C32.9000607-hus3n9K41k0@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Grant @ 2011-10-03 23:58 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

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.

Best regards, Jon
--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: printf 3
       [not found] ` <4E8A4C32.9000607-hus3n9K41k0@public.gmane.org>
@ 2011-10-04  5:46   ` Michael Kerrisk
       [not found]     ` <CAKgNAkgrL4tXZmrLaauLNxSv7rngKxsnkk8pWA1AoP1urk-_5g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Kerrisk @ 2011-10-04  5:46 UTC (permalink / raw)
  To: Jon Grant; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hi Jon,

On Tue, Oct 4, 2011 at 1:58 AM, Jon Grant <jg-hus3n9K41k0@public.gmane.org> wrote:
> 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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: printf 3
       [not found]     ` <CAKgNAkgrL4tXZmrLaauLNxSv7rngKxsnkk8pWA1AoP1urk-_5g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-10-05  0:04       ` Jon Grant
       [not found]         ` <4E8B9EFA.8020100-hus3n9K41k0@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Grant @ 2011-10-05  0:04 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Michael Kerrisk wrote, On 04/10/11 06:46:
> Hi Jon,
>
> On Tue, Oct 4, 2011 at 1:58 AM, Jon Grant<jg-hus3n9K41k0@public.gmane.org>  wrote:
>> 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.

Best regards, Jon
--
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: printf 3
       [not found]         ` <4E8B9EFA.8020100-hus3n9K41k0@public.gmane.org>
@ 2011-10-05  4:39           ` Michael Kerrisk
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk @ 2011-10-05  4:39 UTC (permalink / raw)
  To: Jon Grant; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

On Wed, Oct 5, 2011 at 2:04 AM, Jon Grant <jg-hus3n9K41k0@public.gmane.org> wrote:
> Michael Kerrisk wrote, On 04/10/11 06:46:
>>
>> Hi Jon,
>>
>> On Tue, Oct 4, 2011 at 1:58 AM, Jon Grant<jg-hus3n9K41k0@public.gmane.org>  wrote:
>>>
>>> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-05  4:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03 23:58 printf 3 Jon Grant
     [not found] ` <4E8A4C32.9000607-hus3n9K41k0@public.gmane.org>
2011-10-04  5:46   ` Michael Kerrisk
     [not found]     ` <CAKgNAkgrL4tXZmrLaauLNxSv7rngKxsnkk8pWA1AoP1urk-_5g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-05  0:04       ` Jon Grant
     [not found]         ` <4E8B9EFA.8020100-hus3n9K41k0@public.gmane.org>
2011-10-05  4:39           ` Michael Kerrisk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox