Re: Implementation errors in strtol()

From: Andrey Chernov <ache_at_nagual.pp.ru>
Date: Sat, 22 Jan 2005 20:20:00 +0300
On Sat, Jan 22, 2005 at 07:40:33AM -0500, Thomas Dickey wrote:
> > Nope.  Just think about it: code which doesn't take this feature into
> > account needs to check for conversion errors by means of verifying
> > endptr.  It simply wouldn't care about errno at all, except for
> 
> That's what I always do - that's the way strtol was first documented.
> Adding errno tweaks on top of that is (as noted) neither portable nor
> necessary.

The story not ends here. After checking endptr you should check for 
overflow, and there you need to consider both cases. See my detailed reply 
to Joerg.

-- 
http://ache.pp.ru/

Received on Sat Jan 22 2005 - 16:20:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:26 UTC