From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public From: William Clodius Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/15 Message-ID: <3444F6A2.2781@lanl.gov>#1/1 X-Deja-AN: 280766315 References: <61g30t$o2n@news-rocq.inria.fr> <343C34A7.B715A348@tonys.ecology.umn.edu> <3440F805.C98BB347@tonys.ecology.umn.edu> <61tfaa$9fr@sis.cambridge.arm.com> <61uoiu$19e$1@goanna.cs.rmit.edu.au> <3443FAEF.EE62B663@powertelglobal.com> <621dsv$h7p$1@goanna.cs.rmit.edu.au> <3444608B.421F2325@ix.netcom.crud.com> Organization: Los Alamos National Lab Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec Paul D. DeRocco wrote: > > Richard A. O'Keefe wrote: > > > > Another point is that Fortran > > applies exactly the same rule to *all* operators: if the compiler > > can determine that the *result* of some subcomputation is irrelevant > > to the value of the whole, it can delete that subcomputation entirely. > > This is certainly true of C++, whose current draft standard > states that the observable effects of running the program must > be the same as if the program were executed as described in the > standard. It's commonly called the "as if" rule. > For better or worse, Fortran is more liberal in its as if rule. If the value returned by a FUNCTION (what O'Keefe implies by *result* above) can be shown to be the same under the assumptions that its arguments and global variables are not modified and any internal state of the FUNCTION does not alter the value returned, then the subcomputation can be deleted entirely. The difference from the vast majority of other languages is in the above assumptions which result in local analysis being sufficient for the as if rule for more than standard library procedures. This means that internal state of FUNCTIONs is intended for efficiency of computation purposes only. It also means that modifications of arguments and global variables by FUNCTIONs are well defined, if at all, only for error flags or similar constructs. However, it is difficult for a compiler to detect intent and report erroneous useages of constructs. -- William B. Clodius Phone: (505)-665-9370 Los Alamos Nat. Lab., NIS-2 FAX: (505)-667-3815 PO Box 1663, MS-C323 Group office: (505)-667-5776 Los Alamos, NM 87545 Email: wclodius@lanl.gov