Numerical Recipes is non-portable code

Karl Heuer karl at haddock.ima.isc.com
Thu Sep 8 06:07:20 AEST 1988


rob at kaa.eng.ohio-state.edu (Rob Carriere) writes:
>marv at 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 at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list