Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!nrl-cmf!cmcl2!brl-adm!umd5!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uiucdcsb!wsmith From: wsmith@uiucdcsb.cs.uiuc.edu Newsgroups: comp.lang.pascal Subject: Pascal User Manual and Report Message-ID: <169900010@uiucdcsb> Date: 17 Feb 88 17:22:00 GMT Lines: 28 Nf-ID: #N:uiucdcsb:169900010:000:1281 Nf-From: uiucdcsb.cs.uiuc.edu!wsmith Feb 17 11:22:00 1988 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. In fact, I believe most people think that it the evaluation of the second part _is_ required. However, the statement goes on: "This means that the programmer must assure that the second factor is well-defined." (and goes on to give a standard example when the second part of an AND expression might access an array out of bounds.) What if the second part of the AND expression has side effects? If my reading of Jensen & Wirth is correct, the result of any program with such side effects is undefined in Pascal! Is this conclusion true? It certainly isn't a pleasant one since there is probably plenty of code that depends on the evaluation of the second part being required. Bill Smith ihnp4!uiucdcs!wsmith wsmith@a.cs.uiuc.edu