[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: [LI] j = ++i * ++i * ++i
> > > if i is initialized to say 3,
> > > what will be the value of j, where
> > > j = ++i * ++i * ++i;
> > > on solaris
> > > using cc answer is
> > > j = 6 * 6 * 6;
>
> unary operators has higher priorty over binary operators.
> so all ++i will get evaluated first justifying above.
> (using only one copy of i)
And this is where I have a problem. Who forced (using only one copy of
i) ??
> > > using gcc answer is
> > > j = 4 * 5 * 6;
>
> after each ++i, value of i at that time is stored somewhere (buffers???)
> so that while evaluating the expression appropiate value of i is chosen
> to give above answer.
And what is then this 'appropriate' ?
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available. Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.