[cfe-dev] Confusion on interpretations
james.dennett at gmail.com
Thu May 16 11:44:43 PDT 2013
On Thu, May 16, 2013 at 11:18 AM, Devchandra L Meetei
<dlmeetei at gmail.com> wrote:
> But parentheses should have highest priority ? even before n>= 4
> On Thu, May 16, 2013 at 11:36 PM, Jeffrey Walton <noloader at gmail.com> wrote:
>> On Thu, May 16, 2013 at 1:51 PM, Devchandra L Meetei <dlmeetei at gmail.com>
>> > SUppose if We have
>> > t = 128;
>> > n = 3;
>> > while ( n >= 4 && ((t = 7) & 0x80) == 0 )
>> > why t is 128 after the loop. As we learnt that parentheses has highest
>> > priority.
>> > Won't in this case t be 7. why the value is still 128?
>> n >= 4 is false, so evaluation stops.
I think you've rather misunderstood what "priority" means with respect
to evaluation of expressions. In any case, C and C++ don't define
priorities; they define a grammar for expressions, and rules for
evaluating them, which include short-circuit evaluation for && on
This really isn't a Clang question though, it's a "learning C and/or
C++" question, not topical for cfe-dev.
More information about the cfe-dev