diff options
Diffstat (limited to 'libgo/go/strconv/atoi.go')
-rw-r--r-- | libgo/go/strconv/atoi.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libgo/go/strconv/atoi.go b/libgo/go/strconv/atoi.go index f6c4efaef60..631b487d976 100644 --- a/libgo/go/strconv/atoi.go +++ b/libgo/go/strconv/atoi.go @@ -57,6 +57,8 @@ const IntSize = intSize const maxUint64 = 1<<64 - 1 // ParseUint is like ParseInt but for unsigned numbers. +// +// A sign prefix is not permitted. func ParseUint(s string, base int, bitSize int) (uint64, error) { const fnParseUint = "ParseUint" @@ -143,7 +145,7 @@ func ParseUint(s string, base int, bitSize int) (uint64, error) { n1 := n + uint64(d) if n1 < n || n1 > maxVal { - // n+v overflows + // n+d overflows return maxVal, rangeError(fnParseUint, s0) } n = n1 @@ -159,10 +161,13 @@ func ParseUint(s string, base int, bitSize int) (uint64, error) { // ParseInt interprets a string s in the given base (0, 2 to 36) and // bit size (0 to 64) and returns the corresponding value i. // +// The string may begin with a leading sign: "+" or "-". +// // If the base argument is 0, the true base is implied by the string's -// prefix: 2 for "0b", 8 for "0" or "0o", 16 for "0x", and 10 otherwise. -// Also, for argument base 0 only, underscore characters are permitted -// as defined by the Go syntax for integer literals. +// prefix following the sign (if present): 2 for "0b", 8 for "0" or "0o", +// 16 for "0x", and 10 otherwise. Also, for argument base 0 only, +// underscore characters are permitted as defined by the Go syntax for +// integer literals. // // The bitSize argument specifies the integer type // that the result must fit into. Bit sizes 0, 8, 16, 32, and 64 |