From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,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/13 Message-ID: <34427B4E.41C6@lanl.gov>#1/1 X-Deja-AN: 280229842 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> Organization: Los Alamos National Lab Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec Paul Rubin wrote: > > Is this C statement equivalent to the Fortran? > My Fortran is very rusty.... :-) > > bool = !(!f() | (!g() & !h())); > > Translation: sets bool to 1 (.true.) if f() is nonzero (.false.) > and g() or h() is nonzero; makes sure all the functions are called, > but they could be called in any order. No it is not equivalent. The Fortran compiler can choose any of the available shortcircuiting paths and hence need not execute more than one of the functions. However unlike C you have not explicitly specified a shortcircuiting path and have no standard conforming means of knowing which (if any) shortcircuiting path it took. In other similar code it need not execute any of the functions, if they had been previously executed and the semantics of Fortran implies that the value returned would not change. I.e., no intervening subroutine call had occurred. -- 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