mips address+symbol issue.

Erik Trulsson ertr1013@student.uu.se
Fri Jan 23 22:46:00 GMT 2004

On Fri, Jan 23, 2004 at 05:26:37PM -0500, Robert Dewar wrote:
> Erik Trulsson wrote:
> >Remember that a[i] is just syntactic sugar for *(a+i).
> I don't think that's right, I think the intention is that
> a[i] is syntactic sugar for *(a+(i)). Nothing else makes
> sense. For example you would be saying that you could
> not have a subscript of the form x[a==b] since it would
> mean *((x+a) == b). That just can't be right.
> To me the quoted program is clearly correct, and if it
> does not work, it's a compiler bug.

Yes, you seem to be right, and I was mistaken.
To be exact the standard says:

   The definition of the subscript operator [] is that E1[E2] is
   identical to (*((E1)+(E2))).

<Insert your favourite quote here.>
Erik Trulsson

More information about the Binutils mailing list