Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: semantics of arith comparisons Message-ID: <15106@smoke.brl.mil> Date: 6 Feb 91 19:48:06 GMT References: <1991Feb6.085315.10468@sics.se> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 8 In article <1991Feb6.085315.10468@sics.se> matsc@sics.se (Mats Carlsson) writes: >This must be a compiler bug. Surely the value of an expression shouldn't >change by storing it in a variable *of the same type* as the expression >has. All bets are off when overflow occurs. You were lucky you didn't get an ABEND instead of merely strange numerical results. For integer arithmetic with reasonable overflow semantics, use an unsigned type.