Date: Thu, 20 Jan 2005 23:55:01 +0300 From: Andrey Chernov <ache@nagual.pp.ru> To: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de> Cc: bde@FreeBSD.ORG Subject: Re: Implementation errors in strtol() Message-ID: <20050120205501.GA69123@nagual.pp.ru> In-Reply-To: <20050120192324.GA30862@uriah.heep.sax.de> References: <20050120192324.GA30862@uriah.heep.sax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 20, 2005 at 08:23:24PM +0100, Joerg Wunsch wrote:
> While the standard explicitly states that empty (or whitespace-only)
> input strings cause an empty subject sequence, which will in turn
> cause no conversion to be performed, single signs ("+" or "-") would
> contain a non-empty subject sequence, so a conversion has to take
> place. FreeBSD erroneously returns EINVAL in that case. As EINVAL is
Just what is eye-catching:
+- can't be compared to whitespace at all. Whitespace is not subject
sequence (2) but initial sequence (1) according to POSIX.
Moreover, POSIX clearly allows EINVAL for strtol():
"If no conversion could be performed, 0 shall be returned and errno may
be set to [EINVAL]"
Reading POSIX will really help you with this issue.
--
http://ache.pp.ru/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050120205501.GA69123>
