Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!cjp From: cjp@Apple.COM (Chris Plummer) Newsgroups: comp.sys.mac.programmer Subject: Re: Bug in MPW Pascal 2.0.2 ??? Message-ID: <33064@apple.Apple.COM> Date: 12 Jul 89 02:01:58 GMT References: <1270@draken.nada.kth.se> Organization: Apple Computer Inc, Cupertino, CA Lines: 29 In article <1270@draken.nada.kth.se> d88-bli@nada.kth.se (Bo Lindbergh) writes: >Consider the following Pascal program. > > program bug; > var > u : 0..65535; > begin > u:=60000; > writeln(u); > end. > >I can compile and link this without getting any rude messages, >but when I run it, it prints > -5536 >when it should print > 60000 >. Does anybody out there know whether this is > a) a previously known bug > b) a previously unknown bug > c) me demanding too much of the compiler? I'm not sure about MPW Pascal 2.0.2, but the 3.0 manual says that the parameter must be of type char, integer, real, string, packed array of char, or boolean. Since an integer is -32768..32767, I'd imaging that it's simply typecasting "u" to an integer which will cause numbers greater that 32767 to be negative. You could assign "u" to a real and then pass the real to writeln. --Chris Plummer