>I found a bug in VC++ .NET 2003 regarding default initialization of
> arrays of primitives in a constructor initialization list, as detailed
[quoted text clipped - 12 lines]
>
> Can anybody confirm if this bug is present in the newer version?
This is the output when compiled with VC2005
During compilation:
warning C4351: new behavior: elements of array 'Init::ai' will be default
initialized
warning C4351: new behavior: elements of array 'Init::bi' will be default
initialized
When running
UnInit:
ai = {-858993460, -858993460, -858993460, -858993460, }
bi = {204, 204, 204, 204, }
Init:
ai = {0, 0, 0, 0, }
bi = {0, 0, 0, 0, }

Signature
Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"
Marcus Kwok - 24 Mar 2006 19:24 GMT
>>I found a bug in VC++ .NET 2003 regarding default initialization of
>> arrays of primitives in a constructor initialization list, as detailed
[quoted text clipped - 30 lines]
> ai = {0, 0, 0, 0, ^H^H}
> bi = {0, 0, 0, 0, ^H^H}
I see, so they fixed it in the new version. Thanks for checking this
for me, and I will not file a bug report.

Signature
Marcus Kwok
>I found a bug in VC++ .NET 2003 regarding default initialization of
> arrays of primitives in a constructor initialization list, as detailed
[quoted text clipped - 4 lines]
> portion of the C++ Standard:
> http://groups.google.com/group/comp.lang.c++/msg/71a9fecc4f5d7d57
Funny enough the following change works as expected:
struct Init_POD
{
int ai[Size];
bool bi[Size];
};
class Init {
Init_POD pods;
public:
Init() : pods() { }
friend std::ostream& operator<<(std::ostream& o, const Init& i);
};
std::ostream&
operator<<(std::ostream& o, const Init& in)
{
o << "Init:\n";
o << "ai = {";
std::copy(in.pods.ai, in.pods.ai + Size, std::ostream_iterator<int>(o,
", "));
o << "\b\b}\n";
o << "bi = {";
std::copy(in.pods.bi, in.pods.bi + Size, std::ostream_iterator<bool>(o,
", "));
o << "\b\b}";
return o;
}
Regards,
Patrick
Marcus Kwok - 30 Mar 2006 16:34 GMT
>>I found a bug in VC++ .NET 2003 regarding default initialization of
>> arrays of primitives in a constructor initialization list, as detailed
[quoted text clipped - 19 lines]
> friend std::ostream& operator<<(std::ostream& o, const Init& i);
> };
Hmm, that is interesting! Thanks.

Signature
Marcus Kwok