When a function behave when "return" out o of the function in C++
<p>I have a code. like this:</p>

<pre><code>int functionA (){
    Foo(**,**,**);
    return 0;
}
</code></pre>

<p>Foo() is a huge function(more than 10,000 lines). Which I don't understand all.Foo function includes some multi-thread code.</p>

<p>The problem now is, if I have "return" code right after Foo, Foo can be run correctly.</p>

<p>If I insert some other code (even a really simple cout code) between Foo() and "return". The Foo function will act weird(partly not run correctly).</p>

<p>I debugged this thing for 3 days. Nothing found.</p>
