Tools, Visual Studio Configuring Validation of Uninitialized Class Members

I am moving a large and complex C ++ server from Solaris to Windows. I ran into a lot of problems due to uninitialized member variables. On Solaris, they default to 0, so everything works fine. But in windows, these member variables get the garbage values ​​assigned to create chaos in the system.

The code base is too large to manually check each class. Are you aware of any Visual Studio tools or settings that would give a warning if member variables are not initialized in the constructor?

Thanks in advance!

+4
source share
3 answers

cppcheck does a very good job of finding uninitialized variables.

+4
source

You can also use an external tool for such a task, such as PCLint .

+1
source

You can enable code analysis in Visual Studio (C ++ projects): Project properties β†’ C / C ++ β†’ Enable code analysis for C / C ++ when building

0
source

All Articles