Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!zodiac!joyce!sri-unix!garth!smryan From: smryan@garth.UUCP (Steven Ryan) Newsgroups: comp.lang.c Subject: Re: Array indexing vs. pointers... Message-ID: <1444@garth.UUCP> Date: 20 Sep 88 20:43:42 GMT References: <8809191521.AA17824@ucbvax.Berkeley.EDU> <33488@xait.CCA.COM> Reply-To: smryan@garth.UUCP (Steven Ryan) Organization: INTERGRAPH (APD) -- Palo Alto, CA Lines: 17 > for (i=0;ia batch of code referring to a[i] > } >versus > tmp = a; > for (i=0;i same code referring to *tmp > } Just to muddy the waters. Most cpus allow address expressions like constant_offset+base_register, where base registers are a scarce resource. In the first case, the loop refers to a[i], b[i], ..., the compiler can sometimes generate better code by only putting i in a register and leaving a_base_address, b_base_address, ... as constant offsets. Making a separate pointer for each array can scrunch the register file. Just a reminder that optimisation is not a trivial process.