3 ms·
> // It's a 2's complement machine, this'll work Let's see, that's not an assumption you can make in C, or is it? I seem to remember that a compiler is allowed
by Bromskloss 9y ago
> // It's a 2's complement machine, this'll work
Let's see, that's not an assumption you can make in C, or is it? I seem to remember that a compiler is allowed to present to the programmer at least one or two representations other than two's complement.
- int_19h 9y agoFrom C99 on, it's either one of: two's complement, ones' complement, or sign + magnitude.
- Bromskloss 9y agoThat's sounds familiar, so it's probably what I've read. What did previous versions say?
- int_19h 9y ago"The type char, the signed and unsigned integer types. and the enumerated types are collectively called integral types. The representations of integral types shall define values by use of a pure binary numeration system." And a footnote on that: "A positional representation of integers that uses the binary digits 0 and 1, in which the values represented by successive bits are additive, begin with 1, and are multiplied by successive integral powers of 2, except perhaps the bit with the highest position."