low level optimization

Rob Carriere rob at mckinley.eng.ohio-state.edu
Mon Apr 29 05:15:44 AEST 1991


In article <5079 at cernvax.cern.ch> burow at cernvax.cern.ch (burkhard burow)
writes: 
>jlg at cochiti.lanl.gov (Jim Giles) gives us the example 
[IM alias in C]
>Now lets rewrite this in everybody's favourite language
[same example in FORTRAN]
>Now I just don't get it. If the C compiler/linker/what_ever_you_call_it can't
>optimize the nonalias in func3, and not screw up with the alias in func2,
>what's so magical about FORTRAN? It would seem to be in the same boat.

Nope, it isn't.  FORTRAN simple states that such programs ar illegal.
(undefined behavior is the C standard speak, I'm no longer sure of the
FORTRANesque).  So basically, in FORTRAN you are responsible for staying out
of the compiler's way, and in C it's the other way around.  This makes for
safer programming on the C side of the fence (never thought you'd hear _that_
about C, right :-), but it also makes the C compiler's[1] job _much_ harder.

>hoping somebody reads this line.

I did. :-)

SR
[1] compiler is used here to mean translator+linker+loader.  It was
    convenient, and I feel like Humpty Dumpty today.  :-)
---



More information about the Comp.lang.c mailing list