tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [PATCH 1/6] fix ambiguous errno treating after mktime()
On Mon, Sep 01, 2008 at 06:07:42PM +1000, Giles Lean wrote:
> Unfortunately I don't have a copy of the ISO C
> standard to hand to check what it says for C99.
7.5 paragraph 2:
: [...] and
: errno
: which expands to a modifiable lvalue (175) that has type int, the value
: of which is set to a positive error number by several library
: functions.
(175) says
: The macro errno need not be the identifier of an object. It might
: expand to a modifiable lvalue resulting from a function call (for
: example, *errno()).
One may also note in the context of this thread that 7.5 paragraph 3
says:
: 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.
where (176) says
: Thus, a program that uses errno for error checking should set it to
: zero before a library function call, then inspect it before a
: subsequent library function call. Of course, a library function can
: save the value of errno on entry and then set it to zero, as long
: as the original value is restored if errno's value is still zero
: just before the return.
I'm aware that POSIX sets a lower standard, but I don't see what's
particularly desirable about it.
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index