Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!4526P%NAVPGS.BITNET@CUNYVM.CUNY.EDU From: 4526P%NAVPGS.BITNET@CUNYVM.CUNY.EDU (LT Scott A. Norton, USN) Newsgroups: comp.lang.pascal Subject: Re: Pascal User Manual and Report Message-ID: <11917@brl-adm.ARPA> Date: 19 Feb 88 20:43:41 GMT Sender: news@brl-adm.ARPA Lines: 39 I don't have the actual ISO Pascal standard, but the ISO/DIS 7185 draft standard has this to say: ----------------------------------------------------------------------- 6.7.2 Operators 6.7.2.1 General multiplying-operator = "*" | "/" | "div" | "mod" | "and" . adding-operator = "+" | "-" | "or" . relational-operator = "=" | "<>" | "<" | ">" | "<=" | ">=" | "in". A factor, or a term, or a simple-expression shall be deignated an operand. The order of evaluation of the operand of a dyadic operator shall be implementation-dependent. NOTE: This means, for example, that the operands may be evaluated in textual order, or in reverse order, or in parallel or they may not both be evaluated. ------------------------------------------------------------------------- I was surprised to read this, because it does not apply to just "and" and "or". It would be legal to handle the expression a := b * SideEffect(c); so that SideEffect(c) is not evaluated if b is zero. It should be noted that Ada has very explicit rules about the order of evaluation and what optimizations can be made. In particular, Ada has two constructs for each of "and" and "or": "and" will evaluate both operands, "and also" will evaluate the second only if the first is true. Similarly, "or" evaluates both, but "or else" evaluate the second only if the first is false. So you can use the construct if ( p<>nil ) and also ( p@.data = target ) then ... LT Scott A. Norton, USN Naval Postgraduate School Monterey, CA 93943-5018 4526P@NavPGS.BITNET 4526P@NPS.ARPA