low level optimization

Doug Gwyn gwyn at smoke.brl.mil
Thu Apr 18 15:35:21 AEST 1991


In article <21660 at lanl.gov> jlg at cochiti.lanl.gov (Jim Giles) writes:
-All array arguments to a procedure must be assumed aliased to each
-other and to any globals of the same base type.

No, this is not true (assuming you are talking about pointer
arguments; C does not have array arguments).  As I and others
have recently told you, sometimes this must be assumed and
other times it need not be, depending on context.

-Indeed, due to the fact that most C programmers violate the rules
-prohibiting type casts of pointers to different types, all arrays
-should be assumed aliased to globals and other pointers of _any_
-type.

We know you're a Fortran bigot, but that's ridiculous.

-|> I wasn't particularly referring to array-intensive applications
-|> anyway, because most interesting "scientific" applications that
-|> I have encountered require more flexibility than the use of fixed
-|> arrays provides.  Each language should be dealt with on its own
-|> terms, not treated as an inferior substitute for one's favorite
-|> language.
-Then you shouldn't make unqualified statements that are not true.
-Your claim was that C was inherently as fast or faster than Fortran
-for all operations (you made the exception of _old_ C implementations
-that forced double computation instead of float).  To now say that you
-weren't including array-intensive applications is a little late.

You have this annoying habit of pretending I said things that I didn't.
I didn't EXCLUDE array operations in the statement sited above, and I
didn't say that C was inherently as fast as Fortran for all operations.
What I said was:

->>> I don't think that is the proper explanation of the observed phenomenon.
->>> For any commercial-quality system, I would be amazed if an equally
->>> competent implementation of nearly any algorithm in Fortran and C gave
->>> much edge to Fortran.  The one possibility for a significant speed
->>> difference of which I am aware is the requirement for pre-ANSI C that
->>> all floating-point computations be performed in double precision, even
->>> if the variables are declared as single-precision.  Standard C discards
->>> that old requirement.

I don't see any point in continuing to argue with you, any more than
the last time you stuck your nose into the C newsgroup to run down the
language and promote Fortran for everything.  If you want a more complete
picture of the "aliasing problem" in C, you should read some of the
papers from NCEG.  "A little knowledge is a dangerous thing."



More information about the Comp.lang.c mailing list