low level optimization

Jim Giles jlg at cochiti.lanl.gov
Wed Apr 24 00:45:14 AEST 1991


> [...]                       Any reasonable language that
> supports pointer arguments needs to deal with this issue one
> way or another; Fortran came down on the side of restricting
> the programmer, while C came down on the side of empowering
> the programmer.  [...]

No.  Fortran restricted the programmer in one way, C restricted the
programmer in a different way.  In Fortran, if I want to do things
in an overlapping way to a single array, I must pass that array 
around by itself and make the overlap explicit everywhere it
occurs.  In return for that constraint, the compiler optimizes
my code _much_ better than it could if it had to assume all
array arguments were aliased to each other.  In C, the compiler
prevents me from telling the compiler in any way whatsoever that
pointer arguments are not aliased - even though they _usually_
aren't.  In return, I get the dubious advantage of hiding overlap
from procedures.

For a language to _empower_ the user, it must provide a portable
and explicit way of telling the compiler whether two arguments are
allowed to be aliased.  Neither language does this.  In fact, no 
language in popular use does.

J. Giles



More information about the Comp.lang.c mailing list