Implementation errors in strtol()

Andrey Chernov ache at nagual.pp.ru
Sat Jan 22 09:20:02 PST 2005


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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 305 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050122/a52075c5/attachment.bin


More information about the freebsd-current mailing list