When do you use "if ( a = b )"? (was Re: Funny mistake)

Eamonn McManus em at dce.ie
Wed Apr 3 06:57:08 AEST 1991


ark at europa.att.com (Andrew Koenig) writes:
>It turned out that the effects differed if the subtract
>caused an overflow (call it underflow if you like) with a
>zero result.  In the first case, the test would show that
>a==0.  In the second, the condition code would show an
>overflow.  Overflow is not the same as zero, so the test
>would fail.

Was this a 1s-complement machine?  A sane 2s-complement machine can't
produce 0 on subtraction unless the numbers are equal.

,
Eamonn



More information about the Comp.lang.c mailing list