variables in functions storage
<p>When I declare some variables inside a function and then call that function inside a loop, are the variables destroyed and reconstructed at each step? Is that bad and can/should be avoided? Here an example of what I'm doing:</p>

<pre><code>    void myfun(vector&lt;double&gt; &amp;x){
         vector&lt;double&gt;y;
         y.resize(x.size());
         //computation
    }

    int main(){
        vector&lt;double&gt;x(3,0);
        for(int i=0;i&lt;5000;i++)
        myfun(x);
    }  
</code></pre>
