There's no hard rule about when the result of the pre-increment operation is stored within a - so output you're seeing is a direct result of the way your compiler works. its highly likely that your output would vary on different platforms and compilers. On your platform, it looks as if the result of ++a is stored as soon as that operation has finished - the next call to ++a works with that result rather than the original value of a.
You're also mixing in operators which take different levels of precedence in C++'s operator hierarchy (Those nearer the top are always evaluated before those nearer the bottom). Take a look at this reference on operator precedence for more information on why ++a is evaluated before << http://www.cpprefere...ator_precedence
in summary - the evaluation order of that expression isn't as trivial as it appears
This post has been edited by Bench: 02 January 2009 - 07:37 AM