On Sep 15, 9:15 am, nitin mathur <[email protected]> wrote:
> @ Tanmoy
> Same logic I explained..interviewer didn't give me any clue whether
> the explaination is correct or not..
>
> but when I googled it now I found the answer 56.
Still not correct. The standard was specific (I assume the
latest version hasn't changed on this point), you are allowed
to modify an lvalue once in between sequence points and
if you do the only reason you can read the value is when
it is necessary to determine the new value. So even
x= i++ * i;
or
foo(i++ , i);
is undefined behaviour.
The order of operations between sequence points is, to
some extent, indeterminant. The compiler is allowed to
rearrange them as long as all side effects are resolved
before the next sequence point.
--
Geoff
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---