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
Can you do something like this?
class Outer { public: Outer() { memset(&inner_, 0, sizeof(inner_)); } private: union Inner { int qty_; double price_; } inner_; };
...or maybe something like this?
union MyUnion { int qty_; double price_; }; void someFunction() { MyUnion u = {0}; }