Path: utzoo!attcan!uunet!husc6!uwvax!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.fortran Subject: Re: Fortran versus C for numerical analysis Message-ID: <13547@mimsy.UUCP> Date: 14 Sep 88 03:28:50 GMT References: <410@marob.MASA.COM> <3445@lanl.gov> <183@djs.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 40 In article <183@djs.UUCP> samperi@djs.UUCP (Dominick Samperi) writes: >The emphasis on _can_ is important here .... Indeed. >[some features] might be classified ... as "advanced" features >of the language, and avoided entirely in numerical applications. Alas, unless there were some way to signal to the compiler that this were the case, or unless it were obvious, it would not help the compiler generate better code. (Fortunately, what is `obvious' is growing by leaps and bounds in compiler technology. Cross-module optimisation is no longer considered `too hard'. I predict that decent alias detection will soon not be considered `too hard' either. [Never mind that it is in some sense impossible: so is loop optimisation, in the presense of irreducible flow graphs, yet compilers do that today.]) > while(*dest++ = *source++) ; > >could be written like this instead: > > i = 0 ; > while(source[i] != 0) > { > dest[i] = source[i] ; > i = i + 1 ; > } > dest[i] = 0 ; Any half-decent optimiser should have no trouble converting the former to the latter (with `source += i, dest += i' added). (This assumes that the latter is more efficient. Typically optimisers have had to convert the latter to the former.) I do suggest, though, that no one use `i = i + 1' to increment. If you dislike `++', use `i += 1'. When you mean `add one to i', why not *say* it? -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris