Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!kth!draken!d88-bli From: d88-bli@nada.kth.se (Bo Lindbergh) Newsgroups: comp.sys.mac.programmer Subject: Re: Bug in MPW Pascal 2.0.2 ??? Message-ID: <1275@draken.nada.kth.se> Date: 12 Jul 89 17:15:28 GMT References: <1270@draken.nada.kth.se> <33064@apple.Apple.COM> Reply-To: d88-bli@nada.kth.se (Bo Lindbergh) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 38 In article <33064@apple.Apple.COM> cjp@Apple.COM (Chris Plummer) writes: >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'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. You mean printing longints isn't allowed? Since the type of u is a subrange of longint, the compiler should complain when I try to pass it as a parameter to writeln. And this program: program bugTwo; var l : longint; begin l:=60000; writeln(l); end. prints 60000 and nothing else. Finally, if I assign the value of u to a real, the result is -5536. I don't think the problem has anything to do with writeln. More suggestions, anyone? In confusion, Bo Lindbergh