Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!sco!seanf From: seanf@sco.COM (Sean Fagan) Newsgroups: comp.lang.misc Subject: Re: NOT Educating FORTRAN programmers to use C Message-ID: <4561@scolex.sco.COM> Date: 24 Jan 90 13:58:59 GMT References: <17036@megaron.cs.arizona.edu> <14203@lambda.UUCP> Reply-To: seanf@sco.COM (Sean Fagan) Organization: The Santa Cruz Operation, Inc. Lines: 28 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. 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. -- Sean Eric Fagan | "Time has little to do with infinity and jelly donuts." seanf@sco.COM | -- Thomas Magnum (Tom Selleck), _Magnum, P.I._ (408) 458-1422 | Any opinions expressed are my own, not my employers'.