I frequently define unions inside functions like this:
union
{
sometype A;
othertype B;
}name;
and then go around using them like:
name.A = smth;
name.B = smthelse;
and while it works in debug mode, in release mode it tells me that the union is uninitialized and in some places where the union members are pointers, it even crashes.So how do I initialize them?Is it sufficient to just add '=' operators?Shouldn't it have a default constructor anyway?