g++ option that will retain the value of an unreference variable
<p>I am having a hard time debugging a code which contains a variable that holds an object. Its value doesn't retain. Like this,</p>

<pre><code>//foo.cpp
CCustomClass cfoo = CStaticClass::cfoo_static; // cfoo_static is a static member object

void footest()
{
    // code here that use cfoo but cfoo is empty
}

//main.cpp
int main()
{
   footest();
   return 0;
}
</code></pre>

<p>Please take note that cfoo is a global in foo.cpp. I'm just wondering if there is an g++ option that will retain the value of a global variable cfoo.</p>

<p>And also please take note that the application will work if I change the cfoo to hold the reference, like this,</p>

<pre><code>//foo.cpp
CCustomClass&amp; cfoo = CStaticClass::cfoo_static; // cfoo_static is a static member object
</code></pre>

<p>But I want to use the first example.</p>

<p>Please advice. Thanks.</p>
