a[i] vs. *(a+i)

Andrew Koenig ark at alice.UUCP
Wed May 24 06:25:23 AEST 1989


I would be not the least bit surprised to find that some
C compilers generate different machine code for a[i] and
*(a+i).  The most likely reason is that the compiler
realizes that a[i] is a common usage and has some hack
to recognize it and generate particularly efficient code.

If the code for a[i] and *(a+i) do different things, though,
the compiler is broken.
-- 
				--Andrew Koenig
				  ark at europa.att.com



More information about the Comp.lang.c mailing list