Golang untyped int overflow on 32-bit arm
I am trying to create a switch on a 32-bit signed integer returned from a C function. This is all being compiled for a 32-bit ARM system via: GOARCH=arm GOOS=linux CC="..." go build My code is: func ResultToString(value C.int) error { switch int(value) { case 1: return nil case -1: return fmt.Errorf("Unknown") case 0xF3210123: return fmt.Errorf("Line high") } return fmt.Errorf("bad value") } The error I am receiving is: pkg/app/conversions.go:200:7: 0xF3210123 (untyped int constant 4079026467) overflows int 0xF3210123 in decimal is 4_079_026_467 and fits completely in 32-bits as 1111 0011 0010
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.