low level optimization

Jim Giles jlg at cochiti.lanl.gov
Wed Apr 17 03:06:17 AEST 1991


[...]
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.  [...]

We've been through this again and again.  C can't hold a candle to
Fortran for array manipulation because Fortran is free to assume that
array arguments to procedures are _not_ aliased to each other or to
globals.  C must assume that all pointers are possibly aliased to
each other, to globals, and to any locals to which the & operator
has been applied.  There is not a single significant optimization
technique that is not inhibited to some extent or other by aliasing.

Some C implementations have local extensions (using #pragma statements)
that allow the programmer to declare that certain variables are not
aliased - all very non-portable.  Some experimental systems allow the
compiler to do restricted types of interprocedural analysis to detect
aliasing - this is non-standard since it violates separate compilation
constraints.  I've never seen a purely standard conforming C compiler
that can come close to Fortran.

J. Giles



More information about the Comp.lang.c mailing list