Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Yet Another Silly Question Message-ID: <1754@auspex.auspex.com> Date: 6 Jun 89 17:29:35 GMT References: <6458@sdcsvax.UCSD.Edu] <2550091@hpisod2.HP.COM] <18229@unix.cis.pittsburgh.edu> Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 17 >Also, the scaling operation has simply been moved to the "for" line, as >far as I can tell. The machine still has to dereference &a[MAX] on each >iteration of the loop, doesn't it? I presume you mean "compute" rather than "dereference". (I should *hope* it doesn't dereference the pointer value "&a[MAX]"; since "a" has "MAX" elements, the last element is "&a[MAX-1]", so dereferencing "&a[MAX]" could cause all sorts of problems....) >It really has no way of knowing that &a[MAX] won't change during the >course of the program, Say what? It knows that "MAX" is a constant (assuming this is vanilla C, and not, say, C as extended by compilers such as GCC that permit you to declare automatic arrays of variable size), and it knows that "a" isn't going to move, so it knows that "&a[MAX]" will always be the same address.