Implementation errors in strtol()
Andrey Chernov
ache at nagual.pp.ru
Thu Jan 20 14:47:56 PST 2005
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/
More information about the freebsd-current
mailing list