Path: utzoo!attcan!uunet!husc6!think!ames!pasteur!ucbvax!hplabs!sdcrdcf!csun!polyslo!dorourke From: dorourke@polyslo.UUCP (David O'Rourke) Newsgroups: comp.sys.mac.programmer Subject: MPW Pascal Bug? Or am I wrong. Message-ID: <3203@polyslo.UUCP> Date: 18 Jun 88 04:33:51 GMT Reply-To: dorourke@polyslo.UUCP (David O'Rourke) Organization: Cal Poly State University -- San Luis Obispo Lines: 35 This isn't a serious problem, but I thought I'd share it with netland anyways. Given the following peice of code: procedure doSomething; var X, Y : INTEGER; Z : LONGINT; begin Z := X * Y; end; {doSomething} If X*Y causes an overflow and I have overflow checking turned off it stores the wrong result, usually negative, in Z even though Z is a LONGINT. Now is this what the compiler is suppose to do, or is it suppose to convert to the LONGINT. My problem is that the multiply seems to be taking place in 16-bit precision even thought there is a LONGINT that it's being assigned too. I know the solution, {read work-around}, to this problem. But I was under the impression that the compiler would allow this sort of math and that I wouldn't get the overflow stored in the LONGINT, but I would get the actual value of the multiply, anyone care to comment on this. I'd appreciate any help in understanding why the compiler can't deal with the code as is and yeild the correct result. I'm running the latest version of MPW 2.0 and the lastest version of MPW pascal 2.0. Thanks for any help. -- David M. O'Rourke Disclaimer: I don't represent the school. All opinions are mine!