]> Cypherpunks repositories - gostls13.git/commitdiff
text/template: explain that integer constants can overflow
authorRob Pike <r@golang.org>
Thu, 11 Oct 2018 02:21:54 +0000 (13:21 +1100)
committerRob Pike <r@golang.org>
Thu, 11 Oct 2018 02:32:47 +0000 (02:32 +0000)
This behavior is the same as in Go: constants can be coerced to int
and whether overflow occurs depends on how big an int is, but
this surprises people sometimes, so document it again here.

Fixes #25833.

Change-Id: I557995f1a1e8e871b21004953923d16f36cb9037
Reviewed-on: https://go-review.googlesource.com/c/141378
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/text/template/doc.go

index 4b243067b0f3bee40088bbdc61314fc794c0fc5d..0179dec5c33de6ec9714a8311324d5dd5ca23f86 100644 (file)
@@ -142,7 +142,9 @@ An argument is a simple value, denoted by one of the following.
 
        - A boolean, string, character, integer, floating-point, imaginary
          or complex constant in Go syntax. These behave like Go's untyped
-         constants.
+         constants. Note that, as in Go, whether a large integer constant
+         overflows when assigned or passed to a function can depend on whether
+         the host machine's ints are 32 or 64 bits.
        - The keyword nil, representing an untyped Go nil.
        - The character '.' (period):
                .