Is this supposed to be legal in Go:

var x int32 = 3

fmt.Printf("%d", x & 0xFFFFFFFF)?

The language spec just says the bitwise operator "applies to integers only"
and
"yields a result of the same type as the first operand" that I can see, but
it's giving
me a compiler error:

./main.go:10: constant 4294967295 overflows int32

with go 1.6.2.

Is this a compiler bug, or am I missing something else in the spec that
makes it impossible
to mask out the high bit in a signed integer type without converting to an
unsigned equivalent first?

- Dave

-- 
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