This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mips address+symbol issue.


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
ertr1013@student.uu.se


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]