checking for overflow in C

Henry Spencer henry at utzoo.uucp
Fri May 19 03:04:22 AEST 1989


In article <11538 at ulysses.homer.nj.att.com> ggs at ulysses.homer.nj.att.com (Griff Smith) writes:
>... After doing an `add' that causes overflow, it's
>a bit late to tell the hardware that you were doing an unsigned add.
>Preventing the overflow is often an expensive operation.

Then C's unsigned arithmetic will be expensive on that machine.  Unsigned
arithmetic in C is *required* to be non-overflowing.
-- 
Subversion, n:  a superset     |     Henry Spencer at U of Toronto Zoology
of a subset.    --J.J. Horning | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.lang.c mailing list