sergio masci wrote: > On Mon, 3 Aug 2009, Dave Tweed wrote: > > It's related to the concept of "sequence points" in C. > > In the C99 specification (Clause 6.5#2), it explicitly states: > > > > "Between the previous and next sequence point an object shall have > > its stored value modified at most once by the evaluation of an > > expression." > > > > Operator precedence also plays a role here: You can't modify the > > lvalue on the LHS of an assignment operator while evaluating the > > sub-expression on the RHS, and when you do evaluate the assignment, > > you may only modify the lvalue once. > > > > Therefore, the compiler may need to create an implicit temporary > > variable if you don't have an explicit one in the source code. > > wow there's so much scope for optimisation lost right there. I mean > generating the result in situ. Not really. Anything you can do to "the result in situ" can also be done to a temporary variable, with the only penalty being the space for the temp and the instructions to copy the value at the end. Sometimes, even the final copy can be had for free, as part of whatever the last operation on the result is. -- Dave Tweed -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist