Date: Sat, 22 Jan 2005 18:47:33 +0100 From: Joerg Wunsch <j@uriah.heep.sax.de> To: current@freebsd.org Cc: Andrey Chernov <ache@nagual.pp.ru> Subject: Re: Implementation errors in strtol() Message-ID: <20050122174733.GZ30862@uriah.heep.sax.de> In-Reply-To: <20050122173526.GD39943@nagual.pp.ru> References: <20050121221156.GA21459@nagual.pp.ru> <20050120192324.GA30862@uriah.heep.sax.de> <20050120205501.GA69123@nagual.pp.ru> <20050120211449.GC30862@uriah.heep.sax.de> <20050120214406.GA70088@nagual.pp.ru> <20050120222137.GE30862@uriah.heep.sax.de> <20050121230949.GA34313@VARK.MIT.EDU> <20050122113015.GV30862@uriah.heep.sax.de> <20050122171743.GB39943@nagual.pp.ru> <20050122173526.GD39943@nagual.pp.ru>
index | next in thread | previous in thread | raw e-mail
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. ;-)help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050122174733.GZ30862>
