Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!rpi!uupsi!cmcl2!lanl!lambda!jlg From: jlg@lambda.UUCP (Jim Giles) Newsgroups: comp.lang.misc Subject: Re: JLG's flogging of horses (was Re: Relationship between C and C++) Message-ID: <14319@lambda.UUCP> Date: 10 Apr 90 07:27:26 GMT References: <20026@megaron.cs.arizona.edu> Lines: 22 From article <20026@megaron.cs.arizona.edu>, by gudeman@cs.arizona.edu (David Gudeman): > [...] > This is another statement that is wrong. Compilers can optimize > pointer arithmetic to the same extent as array indexing. You can see why this issue never goes away. People keep asserting the above as if it were true. Arrays can be optimized as well as pointers can, but the reverse is not true without expensive (and rare) global data flow analysis on the interprocedural level. > [...] It is > true that the optimization of pointer arithmetic is more difficult, > but a good enough compiler can detect all possible aliases by global > control flow analysis, even with seperate compilation. That's just the point. The _compiler_ can't do any such thing! That's the _definition_ separate compilation - the different program units are unknown to each other at compile time. The only implementation so far proposed (on the net anyway) which does interprocedual data flow analysis in this way has the _loader_ do code generation. J. Giles