On 1 Feb 2012 at 1:31, Mouse wrote:
Only for negative values, in which case the result can
be whatever the
implementation finds convenient (undefined or implementation-defined).
So, on a system with, say, sign-magnitude arithmetic, masking the
sign off after every operation to force a positive result is
perfectly legitimate way to implement the unsigned type.
Must C language elements be represented by binary numbers? I've
read and heard that it's impossible, but is it really?
Suppose that a machine operated natively in decimal mode. Logical
operation (shift, & | ~ ^) could be implemented as either arithmetic
(left-shift by doubling; right by halving) or by table lookup or
even conversion to a simply binary form on which the operation would
be performed, then converted back to decimal.
Would that machine conform to the C standard?
Can a ones-complement machine conform to the C standard? In other
words, could one elminate -0 from signed arithmetic results and end
up with a conforming machine?
--Chuck
P.S. Forgive me, but since I'm talking wtih someone who knows, I can
get these nagging questions authoritatively answered.