I wonder why do I get zero as an output of this code:
#include <iostream>
class C
{
public:
int m;
C() {}
};
int main ()
{
C c;
std::cout << c.m << '\n';
return 0;
}
I've always thought that a member of a built-in type is not initialized when it is not mentioned in a constructor initializer list. Also, when building in debug mode, the result is what I expect — some non-zero value. Why do I get zero in release mode and don't — in debug? Why do I get zero at all?