According to this question, Visual C ++ 2005 (as well as 2008/2010) does not zero-initialize the correct data.
Since I have code that requires standard behavior, and which crashes in release mode (rather than debugging), I suspect the problem is coming from here.
Now the problem is that the code base is quite large, and manual class checking is difficult.
Is there a compiler option to trigger a warning about this non-standard MSVC behavior? With / W 4, you get warnings about some non-standard extensions (conversions from rvalues to links, missing keywords typename), but not for this particular problem.
EDIT: I suspect such code is causing problems (pasted from a related question)
include <cassert>
struct B { ~B(); Foo* m; };
int main()
{
B * b= new B();
assert ( b->m ==0);
}
in other parts of the code, I have things like
B* b = new B();
and then,
if (b->m) { b->m->bar(); }
and b->mshould be equal to zero by standard, but probably not (except for debug mode). I would like to detect such code (for example, the warning " mused without initialization" or something else)
source
share