Path: utzoo!attcan!uunet!husc6!bloom-beacon!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Numerical Recipes is non-portable code Message-ID: <7142@haddock.ima.isc.com> Date: 7 Sep 88 20:07:20 GMT References: <564@accelerator.eng.ohio-state.edu> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 17 rob@kaa.eng.ohio-state.edu (Rob Carriere) writes: >marv@ism780.UUCP (Marvin Rubenstein) writes: >>[In a hypothetical extended C, with arrays x[5:49] and y[0:44], and an >>integer variable i, the accesses `x[i]' and `y[i-5]' should generate the >>same code on a reasonable compiler.] > >Actually, a reasonable compiler would probably generate better code for >k=x[i]; because it cannot do the optimization I'm trying to manually make >either: illegal pointer! If the architecture in question is "normal", then the compiler *is* free to do that optimization. If the hardware will fault on the mere mention of an illegal pointer, then it can't optimize it -- but how do you think it's going to implement z=x[i], then? They'll still generate the same code, but in this case it'll be equally bad rather than equally good. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint