E
Eric Sosman
[...]
I didn't want to imply that I had any problem with the added complexity
(and don't think I had): I understand very well that there's a real need to
specify in detail how these sorts of conversions need to work.
However, I think it only works as expected if the signed integer type is a
two's complement type. 6.2.6.2s2 allows for three representations, two of
which won't work as expected when ULONG_MAX + 1 is "repeatedly added" as in
6.3.1.3p2.
In what way are your expectations taken aback? I expect (for
example) that negative one will convert to ULONG_MAX, no matter
how the negative one is represented, that negative two will give
ULONG_MAX-1, that zero will give zero, seven seven, and so on.
I've never worked with hardware that had anything other than two's
complement integers, but that is what I meant with the
"implementation-defined" bit.
I worked (very briefly and not in C) with a ones'-complement
Univac machine, back in the 1970's. Before that, I worked with a
signed-magnitude machine -- but it worked in decimal, not binary,
and definitely had no C implementation!
In recent years ("recent" meaning "since sometime in the Ford
administration") I've seen only two's-complement platforms. They're
the wave of the present.