3 ms·
> (it's undefined for unsigned integers in C): No, unsigned integer overflow is defined to wrap around in C. Only signed integer overflow is undefined. > I w
by agwa 11y ago
> (it's undefined for unsigned integers in C):
No, unsigned integer overflow is defined to wrap around in C. Only signed integer overflow is undefined.
> I wonder why Go doesn't just define signed integers to be in 2's complement representation
It does: "The value of an n-bit integer is n bits wide and represented using two's complement arithmetic" (from https://golang.org/ref/spec#Numeric_types https://golang.org/ref/spec#Numeric_types)
- legulere 11y agoYou're right, I wanted to write signed integers. I wonder what they mean with representation in the spec then?