VS 2008 Compiler option for flagging uninitialized variables
Is there a compiler option in VS 2008 (C++) to expose uninitialized variables?开发者_Go百科 I'm trying to debug a problem where the "release" build of a DLL does not work but the "debug" build of the DLL does work.
iirc, setting warning level to 4 will help with this
cl.exe sample.cpp /analyze
here's the link on MSDN
You're looking for warning number C6001
My normal debug builds seem to have this warning enabled:
warning C4700: uninitialized local variable 'xxx' used
and the warning is not present in a release build.
I don't know if this is still relevant but I was just looking for the same thing and found a solution.
You can manually change the warning-level for single warnings. In your case you have to set the level for this particular warning at least as low as your configured level of default-warnings (usually 1 or 2).
Within the project-settings within the C/C++ settings enter a manual command-line switch:
/wYxxxx
with Y being the warninglevel (e.g. 1) and xxxx being the warningnumber in this case you should enter
/w14701
Cheers
精彩评论