Explanation of call ordering in a cout statement, postfix vs prefix
<p>I was overloading the postfix and prefix ++ operator and testing them out, when I noticed something unexpected in the actual value output when printing out my test.  As an example, here is an integer test:</p>

<pre><code>int i = 0;
cout &lt;&lt; "before prefix: " &lt;&lt; i &lt;&lt; " prefixing.. " &lt;&lt; ++i &lt;&lt; " after prefix. " &lt;&lt; i &lt;&lt; endl;
</code></pre>

<p>In my mind, this should print out <code>"before prefix: 0 prefixing... 1 after prefix. 1"</code></p>

<p>To my dismay, this prints <code>before prefix: 1 prefixing.. 1 after prefix. 1</code>
Why is it already 1 at the start of the call?!  Ok,  maybe it parses through the statement before printing and i gets incremented before the printing even begins.  </p>

<p>But then I tested the postfix integer incrementing...</p>

<pre><code>int i = 0;
cout &lt;&lt; "before postfix: " &lt;&lt; i &lt;&lt; " postfixing.. " &lt;&lt; i++ &lt;&lt; " after postfix. " &lt;&lt; i &lt;&lt; endl;

before postfix: 1 postfixing.. 0 after postfix. 1
</code></pre>

<p>The increment happens everywhere but the middle statement?!  This is quite counter intuitive.  Can somebody please shed some light on this?</p>
