Re: Implementation errors in strtol()

From: Andrey Chernov <ache_at_nagual.pp.ru>
Date: Fri, 21 Jan 2005 00:58:07 +0300
On Fri, Jan 21, 2005 at 12:44:06AM +0300, Andrey Chernov wrote:
> > Still, my major point was that "0x" sequences are falsely rejected as
> 
> It clearly should be rejected with EINVAL in case base == 16, 
> because 0 alone is not valid HEX sequence and no valid sequence found at 
> this point. I am not sure about other bases.

It seems I am wrong here and you are right. POSIX says that 0x is optional 
even for base 16. So "0xZ" with base 16 means just 0. If our strtol() 
produce error here, it should be fixed:

"If the value of base is 16, the characters 0x or 0X may optionally 
                                                         ^^^^^^^^^^^
precede the sequence of letters and digits, following the sign if 
present."

-- 
http://ache.pp.ru/
Received on Thu Jan 20 2005 - 20:58:11 UTC

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