Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!amdcad!ames!ll-xn!husc6!endor!singer From: singer@endor.harvard.edu (Rich Siegel) Newsgroups: comp.sys.mac.programmer Subject: Re: Overflow Checking from within Pasca Message-ID: <429@husc6.harvard.edu> Date: 4 Oct 88 11:36:01 GMT References: <4276@polyslo.CalPoly.EDU> <900006@zaphod> Sender: news@husc6.harvard.edu Reply-To: singer@endor.UUCP (Rich Siegel) Organization: Symantec/THINK Technologies, Bedford, MA Lines: 36 In article <900006@zaphod> liberte@zaphod.ncsa.uiuc.edu writes: >This all works. But there is one final problem. You cannot assign the >value 32768 back into an integer variable. I have no solution to this >problem other than turning overflow checking off. But unfortunately, I >discovered that I cannot turn off this overflow checking, even if I >turn it off for the whole project. Is this a bug? Overflow checking checks for integer overflow during computations, not during assignments. If you want to assign a large unsigned value to an integer variable, turn off the "R" compile option, or use {$R-}. >In my case, I can check for this illegal value while it is still >longint and subtract one before taking the LoWord. But this is >an ugly hack, and LSP is broken when it comes to unsigned integers. No, Lightspeed Pascal is *not* "broken" when it comes to unsigned integer. Pascal simply has no provisions for supporting unsigned arithmetic, as C does. In any pascal, the only way to work with unsigned values is to disable overflow and range checking. >Dan LaLiberte --Rich Rich Siegel Staff Software Developer THINK Technologies Division, Symantec Corp. Internet: singer@endor.harvard.edu UUCP: ..harvard!endor!singer Phone: (617) 275-4800 x305 Any opinions stated in this article do not necessarily reflect the views or policies of Symantec Corporation or its employees.