Re: Implementation errors in strtol()

From: Andrey Chernov <ache_at_nagual.pp.ru>
Date: Fri, 21 Jan 2005 01:47:53 +0300
On Thu, Jan 20, 2005 at 11:32:32PM +0100, Joerg Wunsch wrote:
> You can perform a conversion on any valid subject sequence (that ``has
> the expected form'').  The optional sign is part of the valid
> sequence.

As you (and POSIX) say, it is only PART of the valid sequence, but not 
whole valid sequence which could be converted.

> Thus, we do have a subject sequence of the ``expected form''.  Any
> such sequence is convertible per definitionem.

This is just your speculation about what "expected form" is. But POSIX 
clearly says, what expected form is:

"If the value of base is 0, the expected form of the subject sequence is 
                            ^^^^^^^^^^^^^^^^^^^
that of a decimal constant, octal constant, or hexadecimal constant, any 
of which may be preceded by a .+. or .-. sign."

No CONSTANT found in just +- case.

Next, lets see what expected form is, if base is nonzero:

"If the value of base is between 2 and 36, the expected form of the 
                                           ^^^^^^^^^^^^^^^^^
subject sequence is a sequence of letters and digits representing an 
integer with the radix specified by base, optionally preceded by a .+. or 
.-. sign."

The same no SEQUENCE OF LETTERS AND DIGITS found in just +- case.

As I say, read POSIX, please.

-- 
http://ache.pp.ru/
Received on Thu Jan 20 2005 - 21:47:55 UTC

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