Re: Implementation errors in strtol()

From: Joerg Wunsch <j_at_uriah.heep.sax.de>
Date: Sat, 22 Jan 2005 18:47:33 +0100
As Andrey Chernov wrote:

> > even after checking that endptr moved can't check just

> I mean that another case still possible where errno check placed
> _before_ endptr checking, to detect, say, wrong user-entered "base"
> by EINVAL. It can't be detected by portable application in 100%
> cases, because EINVAL can be returned in other cases too.

But you'll probably agree that in 99.99 % of all cases, strtol() is
used using a fixed, developer-given value for base. ;-)

Btw., first checking for a valid conversion (using endptr), and then
checking errno would still work fine in that case, as after the
conversion was identified to be valid, the only source for errno ==
EINVAL remaining is a wrong value for `base'.  So there's still no
need to explicitly consider EINVAL in any other context...

But I guess we are really starting to bore anyone else, so if you
still disagree with the above, let's take that privately, poshalujsta.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
Received on Sat Jan 22 2005 - 16:50:05 UTC

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