D
Dik T. Winter
> Dik T. Winter wrote: ....
> | 6.2.6.2 (Representations of) Integer types, p3.
> | If the implementation supports negative zeros, they shall be
> | generated only by:
> | — the &, |, ^, ~, <<, and >> operators with arguments that
> | produce such a value;
> | — the +, -, *, /, and % operators where one argument is a
> | negative zero and the result is zero;
> | — compound assignment operators based on the above cases.
> | It is unspecified whether these cases actually generate a
> | negative zero or a normal zero, and whether a negative zero
> | becomes a normal zero when stored in an object.
>
> That forbids -0 to be negative zero.
Ah, that makes implementing C on computers that use 1's complement
and are -0 preferent cumbersome! (Note that in hardware, -0
preference is the most natural with 1's complement. To get +0
preference you have to implement the addition as: ~(~a + ~b).)