But why these two way don't have consistent behavior ?

uint(-1)


v :=-1
uint(v)


Michael Jones <michael.jo...@gmail.com>于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 <sunf...@gmail.com> 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 golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
>
> --
> Michael T. Jones
> michael.jo...@gmail.com
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to