tech-userlevel archive

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

Re: strtonum(3) from OpenBSD?

On Fri, Jun 26, 2009 at 07:40:34AM +0000, David Holland wrote:
> If it *can* set errno on success, which is the usual convention for
> library functions, there's no fully safe way to distinguish an
> overflow from a valid return of LONG_MAX or LONG_MIN.

As long as we are talking about POSIX, the specification of the function
is pretty clear that it does not change the value of errno in that case.

At least setting errno to 0 and checking explicitly for ERANGE should be
correct for pure C99 as well, but I don't have a copy of the standard
with me right now to verify.


Home | Main Index | Thread Index | Old Index