You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When uint is decreased into negative value, it does not return constant .... overflows int error but instead it will return 18446744073709551615. So there is no overflow guard for unsigned integers.
This works as expected:
fmt.Println(1<<64)
returns error: constant 18446744073709551616 overflows int
this does not:
var u uint
fmt.Println(u)
u--
fmt.Println(u)
prints
0
18446744073709551615
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?When
uint
is decreased into negative value, it does not returnconstant .... overflows int
error but instead it will return 18446744073709551615. So there is no overflow guard for unsigned integers.This works as expected:
this does not:
The text was updated successfully, but these errors were encountered: