Hi,
It not clear what you wish to achieve. But Let me take a guess. You want to
initialize all the members of the struct to 0. There are two ways.
a) Have a ctor for MyStruct and initialize it 0. This will
initialize all the members to null when an object of the struct is created.
struct MyStruct
{
int a[5];
//other members
//etc.....
//stuct ctor
MyStruct()
{
ZeroMemory(this,sizeof(MyStruct)); // or use
memset
}
};
b) Call Zeromemory or memset in the ctor of the class to set all the
members of the struct to null
MyClass::MyClass()
{
ZeroMemory(&m_MyStruct, sizeof(MyStruct));
}
HTH

Signature
_____________________
Ashok K Kumar
ashokkal at gmail dot com
> Hi C++ experts!
> Definitely I skipped C/C++ 101 because I have this pitfall:
[quoted text clipped - 34 lines]
> Thank you
> Karl
Karl M - 26 Dec 2004 03:37 GMT
Hi Ashok,
I guess I was not very explicit with my message:
I was hoping that there is a way to call the "default" constructor for a
structure inside the class constructor body.
Again, if you don't define a constructor for a struct and define the class
constructor like:
MyClass::MyClass() : m_MyStruct() {}
the compiler generate the underlying struct ctor code that init with NULL
the struct members not using any RTL ZeroMemory or any other calls but just
using push 5; pop ecx; rep stos [m_MyStruct].
Regards,
Karl
> Hi,
>
[quoted text clipped - 61 lines]
> > Thank you
> > Karl