Loops and the call stack
<p>If I use the following in a loop:</p>

<pre><code>    ostringstream glob;
    glob &lt;&lt; "some words";
    cout&lt;&lt; "this is bob"&lt;&lt;glob.str()&lt;&lt;endl;
</code></pre>

<p>glob is reset each iteration.  However if I declare glob outside of the loop then "some words" keep getting added each iteration resulting in a longer and longer string.</p>

<p>I am trying to understand why.  Is this because this variable is being popped off the stack each time the loop goes round?</p>

<p>I thought that if I were "redclaring" glob each loop then I would get an error, but I dont....</p>
