Path: utzoo!attcan!uunet!lll-winken!lll-tis!mordor!joyce!ames!hc!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.fortran Subject: Re: Fortran versus C for numerical analysis Message-ID: <3445@lanl.gov> Date: 12 Sep 88 20:00:05 GMT References: <410@marob.MASA.COM> Organization: Los Alamos National Laboratory Lines: 23 From article <410@marob.MASA.COM>, by samperi@marob.MASA.COM (Dominick Samperi): > This ambiguity is easily avoided by following the rule: "a > variable that is auto-incremented/decremented should never appear on > both sides of the '=' operator." Who's putting programming guidlines into a language _now_? Why can't C make the above rule part of the standard and have done with it? That way the compiler could check for this error (and, it really is an error in every use I've ever seen). The alias rule in Fortran is indeed comparable (as you pointed out), and Fortran correctly rules this to be illegal (even though aliased arrays are more difficult to check). C doesn't outlaw aliased arrays either (thgat's why dynamically allocated multi- dimensional arrays don't optimize well in C - they are implemented as an array of pointers which _can_ point to aliased areas of memory). This is, by the way, what I mean when I say that C doesn't have the concept of array (that is, a one or more dimensional collection of data of identical type, no part of which is aliased to any other part). Fortran extensions to allow dynamic memory all implement multidimensional dynamic arrays the same as statically allocated arrays - the optimizer doesn't have to assume that aliasing is possible so it does better than C does. (Note: the Fortran 8x proposal for allocatable arrays follows this rule as well.) J. Giles