title: How to initialize member-struct in initializer list of C++ class?
body: <p>I have the following class definitions in c++:</p>
  
  <pre><code>struct Foo {
    int x;
    char array[24];
    short* y;
  };
  
  class Bar {
    Bar();
  
    int x;
    Foo foo;
  };
  </code></pre>
  
  <p>and would like to initialize the "foo" struct (with all its members) to zero in the initializer of the Bar class. Can this be done this way:</p>
  
  <pre><code>Bar::Bar()
    : foo(),
      x(8) {
  }
  </code></pre>
  
  <p>... ?</p>
  
  <p>Or what exactly does the <em>foo(x)</em> do in the initializer list?</p>
  
  <p>Or is the struct even initialized automatically to zero from the compiler?</p>