Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!udel!gatech!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!iuvax!bsu-cs!neubauer From: neubauer@bsu-cs.UUCP (Paul Neubauer) Newsgroups: comp.lang.pascal Subject: Re: Pascal User Manual and Report Message-ID: <2149@bsu-cs.UUCP> Date: 18 Feb 88 14:56:46 GMT References: <169900010@uiucdcsb> Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 28 In article <169900010@uiucdcsb>, wsmith@uiucdcsb.cs.uiuc.edu writes: > I was just looking at Jensen & Wirth's _Pascal User Manual and Report_. > In the section on the AND and OR operators, it says: > "Assume for example, that x=0. Then > (x>0) and (x<10) > is already known to be false after computation of the first factor, and the > scond need not be evaluated. The rules of Pascal neither require nor forbid > ^^^^^^^^^^^^^^^ > the evaluation of the second part in such cases." > > Is this still true in the "current definition" of Pascal. All of the > implementations I've found will evaluate the second part. It turns out that this is not quite true. VAX Pascal does not (necessarily) evaluate the second part. I am not completely sure if this behavior depends on optimization levels or some such, but around here, the local default is /NOOPTIMIZE and even something like: x := 1; y := 0; IF (x < y) AND (x/y <> 1) THEN ... will not crash. -- Paul Neubauer neubauer@bsu-cs.UUCP !{iuvax,pur-ee,uunet}!bsu-cs!neubauer