I have a structure which I create a custom constructor to initialize the members to 0\'s. I\'ve seen in older compilers that when in release mode, without doing a memset to
As mentioned in Greg Rogers' comment to unwesen's post, you can give your union a constructor (and destructor if you wish):
struct foo { int a; int b; }; union bar { bar() { memset(this, 0, sizeof(*this)); } int a; foo f; };