Path: utzoo!attcan!uunet!cs.dal.ca!aucs!880716a From: 880716a@aucs.uucp (Dave Astels) Newsgroups: comp.lang.pascal Subject: Re: Funny evaluation of functions Message-ID: <1989Aug24.122149.18977@aucs.uucp> Date: 24 Aug 89 12:21:49 GMT References: <20693@adm.BRL.MIL> Reply-To: 880716a@aucs.UUCP (Dave Astels) Organization: School of Computer Science, Acadia Univ., Nova Scotia Lines: 26 In article <20693@adm.BRL.MIL> fsbrn@BRL.MIL (VLD/LTTB) writes: ... >Remember that in Pascal you may not say > var num [1..MAX] of integer; > if (i <= MAX) AND (num[i] <> 17) >because the standard says the entire expression must be evaluated, but >also because it doesn't guarantee that the second expression won't be >evaluated before the first one (and because Pascal doesn't terminate >boolean expressions as soon as possible). Ahh! Maybe in insufficiently capable 'standard' Pascal, but it is perfectly ok in Turbo Pascal (ver 4 and up, anyway). You can set boolean expressions to be short circuited. This makes the above code snipet quite reasonable. Because of this, left to right evaluatioin is gaurenteed (it has to be in order for it to work). I've used standard Pascal on our Sun, and compared to Turbo (I'm using 5.5 now .. marvelous package) it seems prehistoric. Hey, standard Pascal is prehistoric, isn't it. -- - Dave Internet: 880716a@AcadiaU.CA Bitnet: 880716a@Acadia