But why these two way don't have consistent behavior ? uint(-1)
v :=-1 uint(v) Michael Jones <[email protected]>于2017年2月26日 周日上午11:35写道: > yes. > https://en.wikipedia.org/wiki/Two's_complement > > On Sat, Feb 25, 2017 at 10:21 PM, Felix Sun <[email protected]> wrote: > > https://play.golang.org/p/TmxMmltHGH > > package main > > import ( > "fmt" > ) > > func main() { > var f int = -1 > fmt.Println("become huge number:", uint(f)) > fmt.Println("this panic", uint(-1)) > > } > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > > > > > -- > Michael T. Jones > [email protected] > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
