Give me a warning please !!
Actually it is common that programmers should switch between C# programming an C++ programming. This is my case, and when I switch to VC++ programming I really miss the C# compiler.
Today I spend 1 hour debugging (C++) because I wrote a code like this
CString Item::GetMessage()
{
CString sXml;
if (m_Info == NULL)
sXml.Format("%s", "Empty Item");
else
{
CString sXml;
sXml.Format("The Information is: %s", m_Info->GetInfo());
}
return sXml;
}
As you can see I redefined sXml, then my function always return "Empty Item" or "".
If you compile a similar code using C# compiler you are going to get an error ("A local variable named 'sXml' cannot be declared....").
So, C++ compiler please... Give me at least a warning !!