4 ms·
It is independent of the representation of negative numbers on the machine, because of the conversion rules.
by mfukar 16y ago
It is independent of the representation of negative numbers on the machine, because of the conversion rules.
- bad_user 16y agoBecause of two's complement, "-1" as a signed int/long is internally represented with all bits set to 1. Conversion rules are pretty basic, i.e. there is no conversion done on the actual value, so that's why it works: converting "-1" to an unsigned int yields MAX_UINT.
- mfukar 16y agoWhat I mean is that the conversion: unsigned int flags = -1; always works, regardless of whether negative numbers are represented in two's complement, one's complement, or sign/magnitude on the underlying hardware.