title: How to zero-initialize an union?
body: <p>Consider the following code:</p>
  
  <pre><code>struct T {
      int a;
      union {
          struct {
              int a;
          } s1;
          struct {
              char b[1024];
          } s2;
      };
  };
  
  int main() {
      T x = T();
  }
  </code></pre>
  
  <p>Since an explicit constructor is called, the above code ends-up zero-initializing all the data members in x.</p>
  
  <p>But I would like to have x zero-initialized even if an explicit is not called. To do that one idea would be to initialize the data members in their declaration, which seems to be okay for T::a. But how can I zero-initialize all the memory occupied by the union by using
  the same criteria?</p>
  
  <pre><code>struct T {
      int a = 0;
      union {
          struct {
              int a;
          } s1;
          struct {
              char b[1024];
          } s2;
      };
  };
  
  int main() {
      T x; // I want x to be zero-initialized
  }
  </code></pre>