Message from discussion About the array subsripting operator
Received: by 10.180.105.38 with SMTP id gj6mr5140817wib.0.1346980556080;
Thu, 06 Sep 2012 18:15:56 -0700 (PDT)
From: Eric Sosman <esos...@ieee-dot-org.invalid>
Subject: Re: About the array subsripting operator
Date: Thu, 30 Aug 2012 12:58:26 -0400
Organization: A noiseless patient Spider
Injection-Date: Thu, 30 Aug 2012 16:58:29 +0000 (UTC)
Injection-Info: mx04.eternal-september.org; posting-host="ffb8f7085759b339c1002252b48331a4";
logging-data="20978"; mail-complaints-to="ab...@eternal-september.org"; posting-account="U2FsdGVkX18OSmM3qsugrNV0rYtDRArq"
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20120824 Thunderbird/15.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
On 8/30/2012 12:32 PM, Kirilenko wrote:
> Hey c.l.c. !
> I was reading the C11 standard (ï¿½220.127.116.11) :
>> The definition of the subscript operator  is that E1[E2] is identical to
> I would like to know why are brackets around E1 necessary (they were missing
> in the C89 standard), ie in which case can (*(E1+(E2))) be different from
> (*((E1)+(E2))) ?
The parentheses would only make a difference if E1 were an
expression involving operators of lower precedence than `+'.
But any such operator would also have lower prececence than `',
so E1 would already need to be parenthesized:
(which ? array1 : array2) [i]
which ? array1 : array2 [i]
Perhaps the extra parentheses were added for clarity's sake, in
the fear that someone might think E1 in the first line above
was the "bare" `which ? array1 : array2', which would make hash
of the stated equivalence.
(Questions about "Why is the Standard written in thus-and-such
a way?" will probably do better in comp.std.c than in comp.lang.c.
CC'ed, and follow-ups set.)