checking for overflow in C

Leo de Wit leo at philmds.UUCP
Wed May 10 23:23:27 AEST 1989


In article <8143 at june.cs.washington.edu> ka at june.cs.washington.edu (Kenneth Almquist) writes:
|henry at utzoo.uucp (Henry Spencer) writes:
|> C unfortunately has to be close to the hardware of a wide variety of
|> machines.  There is no consensus on whether the hardware checks for overflow
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|> or not.  C generally prefers to reflect the underlying hardware rather
|> than trying to hide it, so this lack of consensus shows to the programmer.
|
|If there is not a consensus, there is certainly an overwhelming majority!
|I know the assembly languages of half a dozen machines, and they all
            ^^^^^^^^^^^^^^^^^^
|include overflow checks.
         ^^^^^^^^^^^^^^^
|				Kenneth Almquist

Unless I'm way off, Henry was talking about hardware checks, to
enforced by the hardware (causing exceptions or traps or similar to
occur whenever they're violated). The overflow checks in an assembly
language, as Kenneth referred to, are compiler generated/programmed in,
are software based checks and thus could/can be left out (I think he
meant either explicitly or implicitly testing the status word).

    Leo.



More information about the Comp.lang.c mailing list