X
xmllmx
The C++11 standard 8.5.4.3 says:
"If the initializer list has no elements and T is a class type with a default constructor, the object is value-initialized."
struct A
{
int get() { return i; }
private:
int i;
};
int main()
{
A a = {};
int n = a.get();
cout << n << endl;
// n is 0xCCCCCCCC rather than 0 when running in debugging mode.
return 0;
}
Is this a bug of VC++? My VC++ is the latest Nov 2012 CTP.
"If the initializer list has no elements and T is a class type with a default constructor, the object is value-initialized."
struct A
{
int get() { return i; }
private:
int i;
};
int main()
{
A a = {};
int n = a.get();
cout << n << endl;
// n is 0xCCCCCCCC rather than 0 when running in debugging mode.
return 0;
}
Is this a bug of VC++? My VC++ is the latest Nov 2012 CTP.