On Apr 14, 2022, at 09:21:28, Robin Vowels wrote:
>
> On 2022-04-15 00:31, Seymour J Metz wrote:
>> The S/360 architecture uses two's complement arithmetic, and that
>> remains the case through z. Accordingly, signed and unsigned
>> arithmetic are the same except for the condition code, except when
>> sign extension is an issue, e.g., adding a word to a grande register..
>
> If the relevant overflow mask bit is set,
> integer overflow causes an interrupt.
>
A couple C implementations (other than XL C/C++ which I haven't
checked) require integer overflow interrupts disabled at runtime.
ANSI C requires unsigned operations to be performed with modulo
arithmetic. For integer overflow either (I don't recall which)
the behavior is unpredictable, allowing an interrupt, or the
value or the result is unpredictable, not allowing interrupt.
Pre-ANSI C specified unsigned-preserving, so:
-1 > (unsigned) 0. /* Ugh! */
ANSI C specified value-preserving, so:
-1 < (unsigned) 0
--
gil