This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Uninitilised variable detection in C++
- From: naveen yadav <yad dot naveen at gmail dot com>
- To: gcc-help at gnu dot org
- Date: Mon, 18 May 2009 19:01:13 +0530
- Subject: Uninitilised variable detection in C++
- References: <9bde694e0905180626v5303306fw9a324c491487bf02@mail.gmail.com>
Hi
I am using GNU compiler and i enable all warnings still i do not get any
warning.
Is there any way to get warning for uninitilised variables in c++ .
class Foo
{
private:
?? int m_nValue;
public:
?? Foo();
?? int GetValue() { return m_bValue; }
};
Foo::Foo()
{
?? // Oops, we forget to initialize m_nValue
}
int main()
{
?? Foo cFoo;
?? if (cFoo.GetValue() > 0)
?????? // do something
?? else
?????? // do something else
}
Best regards
naveen