Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!sun-barr!apple!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!cernvax!chx400!urz.unibas.ch!fritz From: fritz@urz.unibas.ch Newsgroups: comp.lang.pascal Subject: Re: Help Me!!! What's wrong with this simple problem? Message-ID: <1990Nov29.111729.1194@urz.unibas.ch> Date: 29 Nov 90 10:17:29 GMT References: <527@shum.UUCP> <19956@oolong.la.locus.com> <28893@shamash.cdc.com> <1990Nov28.090232.2958@uwasa.fi> <1990Nov28.180310.3147@aftermath.waterloo.edu> Organization: University of Basel, Switzerland Lines: 52 In article <1990Nov28.180310.3147@aftermath.waterloo.edu>, nmouawad@water.uwaterloo.ca (Naji Mouawad) writes: > In article <1990Nov28.090232.2958@uwasa.fi> ts@uwasa.fi (Timo Salmi) writes: >>In article <28893@shamash.cdc.com> mpe@shamash.UUCP (Mike Ebsen) writes: >>>What's wrong with this problem in Turbo Pascal 5.0... >>> >>> Program test; >>> var >>> i : integer; >>> j : word; >>> begin >>> j:=3; >>> i:=j-10; >>> writeln(j,' ',i); >>> end. >>> >>>My compiler tells me that the assignment of -7 into i (an integer) >>>is an error. >> >>Yes, but j-10 is a word, and you cannot assign a negative value to >>to it. As far as I know i := j - 10 puts the value of the >>right-hand side into the left-hand side only after j-10 has been >>calculated. >> >>................................................................... >>Prof. Timo Salmi (Moderating at anon. ftp site 128.214.12.3) >>School of Business Studies, University of Vaasa, SF-65101, Finland >>Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun > > Or it may be a bug in tp5.0 . I ran this program yesterday and > I ran it today twice (with {$R+}) in tp5.5 and it ran like a > charm. No syntax errors, no sweat. > > Anybody out there with tp5.5 could confirm that ? Or is my > version of tp5.5. a freak ? > Sorry, but I cannot confirm that. My TP 5.5 tells me a range checking error when I try to compile the program above with the compiler option {$R+}. Only by setting it to {$R-} or by changing the compiler option in the menu I can compile the program. Perhaps your menu option was RANGE CHECKING OFF and you could compile the program without any problem. If you insert {$R+} into the source code you must press F9 afterwards. Then you will see the error message. If you just press Ctrl-F9 the previously compiled program, which is still in memory, will be run!!! Oliver Fritz, University of Basel, Switzerland Brought to you by Super Global Mega Corp .com