strtoul("-10", ...)

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Jul 27 05:22:07 AEST 1990


In article <GAFTER.90Jul24163928 at m2.csc.ti.com> <gafter at csc.ti.com> (Neal M Gafter) writes:
>...  I presumed the sentence about the minus sign was to
>allow the string "-0" and to recognize (as errors) other negative
>numbers.

No, in fact this was discussed at the last X3J11 interpretation meeting.
The negation is modulo longwordsize, and thus cannot overflow if the
conversion of the portion after the "-" prefix did not overflow.  (By
"overflow" I mean that the converted value value is not representable
in an unsigned long datum.)



More information about the Comp.std.c mailing list