In the Go Tour, page 13, the following is presented:
MaxInt uint64 = 1<<64 - 1
It evaluates correctly as seen when the example gets run; I just can't seem to understand why.
unit64
is the biggest container for an int in Go as far as I understand. At the same time 1<<64
evaluates to an exception when used in an expression (such as in fmt.Printf(1<<64)
) - that is it's not 0 as in several programming languages. Still, when used on the right side of the assignment operator it evaluates fine.
What am I missing here?