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: Paul Rubin Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/13 Message-ID: #1/1 X-Deja-AN: 280211919 Sender: phr@netcom2.netcom.com 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: Netcom Online Communications Services Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec Craig Burley writes: > A similar example of C *requiring* lowering because it doesn't provide > linguistic features other languages (like Fortran) have is illustrated > by the following Fortran snippet: > > IMPLICIT LOGICAL(A-Z) > BOOL = F() .AND. (G() .OR. H()) > > C has no way to express the above. It *requires* you to lower it, to, > for example, > > bool = f() & (g() | h()) > > or: > > bool = f() && (g() || h()) > > C programmers typically claim this "low-level" nature of their language > *allows* them to write "faster" code for a particular machine, but, > in practice, that isn't true in cases like the above, because even > Fortran allows such a thing. The Fortran versions of the above "lowered" > code are [ugly translations snipped] 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.