[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: strtonum(3) from OpenBSD?
On Sat, Jun 27, 2009 at 07:30:39AM +0000, David Holland wrote:
> Ok, what I can find says
> The strtol() function shall not change the setting of errno if
> which is specific permission to assign to it on success, in order to
> preserve the previous value.
> This guarantee does not appear to be provided by C99.
C99 7.5 #3:
The value of errno is zero at program startup, but is never set to
zero by any library function.176) The value of errno may be set to
nonzero by a library function call whether or not there is an
error, provided the use of errno is not documented in the
description of the function in this International Standard.
That is, any function where errno behavior is specified in C99 (which
is not too many, but includes strtol) is not allowed to leave trash in
errno on success.
So it does provide the guarantee after all.
(Note 176 observes that library functions may change errno freely as
long as they also save it and change it back. Notes are not normative
but are sometimes necessary to read the committee's mind about what
the text is supposed to mean.)
David A. Holland
Main Index |
Thread Index |