Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!uwm.edu!psuvax1!rutgers!deimos!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!hirchert From: hirchert@ux1.cso.uiuc.edu Newsgroups: comp.lang.misc Subject: Re: NOT Educating FORTRAN programme Message-ID: <7300006@ux1.cso.uiuc.edu> Date: 24 Jan 90 21:03:00 GMT References: <4561@scolex.sco.COM> Lines: 36 Nf-ID: #R:scolex.sco.COM:4561:ux1.cso.uiuc.edu:7300006:000:1583 Nf-From: ux1.cso.uiuc.edu!hirchert Jan 24 15:03:00 1990 Sean Eric Fagan (seanf@sco.COM) writes >In article <14203@lambda.UUCP> jlg@lambda.UUCP (Jim Giles) writes: >>This is not true. There is _NO_ case that I'm aware of that parenthesis >>are _REQUIRED_ in Fortran (ADA, Pascal, etc.) when they are not also >>_REQUIRED_ in C - and with the _SAME_ consequences with respect to >>optimization. It is with _OPTIONAL_ parenthesis that the languages >>differ. In C, the compiler ignores them, in all the other languages >>the compiler must evaluate in parenthesis order. So, the trade-off you >>mention is under direct user control in all languages but C. > >1. Given > a + b + c - e - f; > >I'm happy to let the compiler rearrange things as much as possible to >generate fast code. In FORTRAN, by your own admission, you can't do that. I don't see him admitting this. In the absence of parentheses, a Fortran processor is free to choose any mathematically equivalent evaluation order (even though this might produce different results in the machine arithmetic). > >2. Given > > ((((a + b) + c ) -e ) - f); > >The compiler is free to rewrite this, *IFF* the result would be the same! >If you're using shorts, and overflows are ignored, then, probably, it can do >what it wants to. If, however, the result is *not* the same, then the >compiler cannot do this, and, if it does, it's a bug. Although the Fortran standard is less explicit about this, Fortran processors are also allowed transformations that don't change the machine results. Kurt W. Hirchert hirchert@ncsa.uiuc.edu National Center for Supercomputing Applications