Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!mit-eddie!uw-beaver!Teknowledge.COM!unix!hplabs!hpcc05!hpcuhb!hpcllla!hpcllz2!dhandly From: dhandly@hpcllz2.HP.COM (Dennis Handly) Newsgroups: comp.sys.apollo Subject: Re: Re: The wonderful Pascal compiler... Message-ID: <5960002@hpcllz2.HP.COM> Date: 15 Nov 90 06:59:11 GMT References: <9011141659.AA08276@umix.cc.umich.edu> Organization: Hewlett Packard Calif. Language Lab Lines: 24 >/ derstad@CIM-VAX.HONEYWELL.COM ("DAVE ERSTAD") / 8:45 am Nov 14, 1990 / >For example, the Pascal code > if (exprA) or (exprB) >may have either exprA or exprB evaluated first. A compiler may choose >to do one or the other ... >Likewise, with > if (exprA) and (exprB) >a compiler may choose to evaluate both expressions even if the first one >it evaluates is false. In fact, it MUST evaluate both when there >is the potential for side effects. The last sentence conflicts with what you have/don't have for OR. I would GUESS the standard says nothing about side-effects. So a compiler doesn't have to evaluate both operands for both AND and OR. I'm pretty sure the ANSI tests attempt to figure out what the compiler does and then puts that on the report. (I.e. for information only.) (Not that the following helps, provided for information only.) HP-UX's 600, 800 and other Pascals provides an option $partial_eval$. The default is on. The 85 COBOL ANSI standard states that a compiler must do partial evaluation. It appears that both C and COBOL have standardized this useful feature. (I'm not sure how they would write a test what would detect the violation, except to index out of bounds?)