Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!unmvax!deimos.cis.ksu.edu!atanasoff!hascall From: hascall@atanasoff.cs.iastate.edu (John Hascall) Newsgroups: comp.lang.c Subject: Re: checking for overflow in C Message-ID: <1079@atanasoff.cs.iastate.edu> Date: 10 May 89 13:53:05 GMT References: <13367@dartvax.Dartmouth.EDU> <1989May6.224226.22085@utzoo.uucp> <1989May9.183140.1770@utzoo.uucp> <8172@june.cs.washington.edu> Reply-To: hascall@atanasoff.cs.iastate.edu (John Hascall) Organization: Iowa State Univ. Computation Center Lines: 30 In article <8172@june.cs.washington.edu> ka@june.cs.washington.edu (Kenneth Almquist) writes: >In article <1989May9.183140.1770@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes: >> In article <8143@june.cs.washington.edu> ka@june.cs.washington.edu (Kenneth Almquist) writes: >OK, I think I see your point. My assumption is that the cost isn't a >big issue because the programmer wouldn't test for overflow unless it >was necessary. You would see an *occasional* test such as: > new C keyword > | > v > if (overflow a = b * c) > printf("Multiplication overflowed\n"); > else > printf("%d * %d = %d\n", b, c, a); Oh, help us please!!!! What are you people trying to do? Turn C into PL/1? If this overflow business is important to you (and it certainly is for some)... Why not use SIGFPE? This works (is documented to work, I've never had occasion to try it) under BSD on the VAX, perhaps it works on your machine as well. Did ANSI have anything to say on this topic? John Hascall ISU Comp Center