]> Cypherpunks repositories - gostls13.git/commitdiff
strconv: document value returned by ParseInt when there is an error
authorRob Pike <r@golang.org>
Fri, 7 Mar 2014 02:23:50 +0000 (13:23 +1100)
committerRob Pike <r@golang.org>
Fri, 7 Mar 2014 02:23:50 +0000 (13:23 +1100)
Documenting existing behavior; new commentary only.
Fixes #7105.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/68840044

src/pkg/strconv/atoi.go

index 2d0db7155f75bc986231c706b91928566dae10f5..cbf0380ec829e5a9f13cef27d442a722dccee639 100644 (file)
@@ -142,9 +142,11 @@ Error:
 //
 // The errors that ParseInt returns have concrete type *NumError
 // and include err.Num = s.  If s is empty or contains invalid
-// digits, err.Err = ErrSyntax; if the value corresponding
-// to s cannot be represented by a signed integer of the
-// given size, err.Err = ErrRange.
+// digits, err.Err = ErrSyntax and the returned value is 0;
+// if the value corresponding to s cannot be represented by a
+// signed integer of the given size, err.Err = ErrRange and the
+// returned value is the maximum magnitude integer of the
+// appropriate bitSize and sign.
 func ParseInt(s string, base int, bitSize int) (i int64, err error) {
        const fnParseInt = "ParseInt"