title: Default, value and zero initialization mess
body: <p>I am very confused about value- &amp; default- &amp; zero-initialization.
  and especially when they kick in for the different standards <em>C++03</em> and <em>C++11</em> (and <em>C++14</em>).</p>
  <p>I am quoting and trying to extend a really good answer <a href="https://stackoverflow.com/questions/620137/do-the-parentheses-after-the-type-name-make-a-difference-with-new">Value-/Default-/Zero- Init <em>C++98</em> and <em>C++03</em></a> here to make it more general as it would help a lot of users if somebody could help fill out the needed gaps to have a good overview about what happens when?</p>
  <p><strong>The full insight by examples in a nutshell:</strong></p>
  <p>Sometimes the memory returned by the new operator will be initialized, and sometimes it won't depending on whether the type you're newing up is a <a href="https://stackoverflow.com/questions/146452/what-are-pod-types-in-c">POD (plain old data)</a>, or if it's a class that contains POD members and is using a compiler-generated default constructor.</p>
  <ul>
  <li>In <em>C++1998</em> there are 2 types of initialization: <em>zero-</em> and <em>default-initialization</em></li>
  <li>In <em>C++2003</em> a 3rd type of initialization, <em>value-initialization</em> was added.</li>
  <li>In <em>C++2011/C++2014</em> only <em>list-initialization</em> was added and the rules for <em>value-/default-/zero-initialization</em> changed a bit.</li>
  </ul>
  <p>Assume:</p>
  <pre><code>struct A { int m; };                     
  struct B { ~B(); int m; };               
  struct C { C() : m(){}; ~C(); int m; };  
  struct D { D(){}; int m; };             
  struct E { E() = default; int m;}; /** only possible in c++11/14 */  
  struct F {F(); int m;};  F::F() = default; /** only possible in c++11/14 */
  </code></pre>
  <p><strong>In a C++98 compiler, the following should occur</strong>:</p>
  <ul>
  <li><code>new A</code>   - indeterminate value (<code>A</code> is POD)</li>
  <li><code>new A()</code>- zero-initialize</li>
  <li><code>new B</code>   - default construct (<code>B::m</code> is uninitialized, <code>B</code> is non-POD)</li>
  <li><code>new B()</code> - default construct (<code>B::m</code> is uninitialized)</li>
  <li><code>new C</code>   - default construct (<code>C::m</code> is zero-initialized, <code>C</code> is non-POD)</li>
  <li><code>new C()</code> - default construct (<code>C::m</code> is zero-initialized)</li>
  <li><code>new D</code>   - default construct (<code>D::m</code> is uninitialized, <code>D</code> is non-POD)</li>
  <li><code>new D()</code> - <em>default construct?</em> (<code>D::m</code> is uninitialized)</li>
  </ul>
  <p><strong>In a C++03 conformant compiler, things should work like so:</strong></p>
  <ul>
  <li><code>new A</code>    - indeterminate value (<code>A</code> is POD)</li>
  <li><code>new A()</code>  - value-initialize <code>A</code>, which is zero-initialization since it's a POD.</li>
  <li><code>new B</code>    - default-initializes (leaves <code>B::m</code> uninitialized, <code>B</code> is non-POD)</li>
  <li><code>new B()</code>  - value-initializes <code>B</code> which zero-initializes all fields since its default ctor is compiler generated as opposed to user-defined.</li>
  <li><code>new C</code>    - default-initializes <code>C</code>, which calls the default ctor. (<code>C::m</code> is zero-initialized, <code>C</code> is non-POD)</li>
  <li><code>new C()</code>  - value-initializes <code>C</code>, which calls the default ctor.  (<code>C::m</code> is zero-initialized)</li>
  <li><code>new D</code>    - default construct (<code>D::m</code> is uninitialized, <code>D</code> is non-POD)</li>
  <li><code>new D()</code>  - <em>value-initializes D?</em>, which calls the default ctor (<code>D::m</code> is uninitialized)</li>
  </ul>
  <p>Italic values and ? are uncertainties, please help to correct this :-)</p>
  <p><strong>In a C++11 conformant compiler, things should work like so:</strong></p>
  <p>??? (please help if I start here it will anyway go wrong)</p>
  <p><strong>In a C++14 conformant compiler, things should work like so:</strong>
  ??? (please help if I start here it will anyway go wrong)
  <em>(Draft based on answer)</em></p>
  <ul>
  <li><p><code>new A</code>    - default-initializes <code>A</code>, compiler gen. ctor, (leavs <code>A::m</code> uninitialized) (<code>A</code> is POD)</p>
  </li>
  <li><p><code>new A()</code>  - value-initializes <code>A</code>, which is zero-initialization since 2. point in <em>[dcl.init]/8</em></p>
  </li>
  <li><p><code>new B</code>   - default-initializes <code>B</code>, compiler gen. ctor, (leavs <code>B::m</code> uninitialized) (<code>B</code> is non-POD)</p>
  </li>
  <li><p><code>new B()</code>  - value-initializes <code>B</code> which zero-initializes all fields since its default ctor is compiler generated as opposed to user-defined.</p>
  </li>
  <li><p><code>new C</code>    - default-initializes <code>C</code>, which calls the default ctor. (<code>C::m</code> is zero-initialized, <code>C</code> is non-POD)</p>
  </li>
  <li><p><code>new C()</code>  - value-initializes <code>C</code>, which calls the default ctor. (<code>C::m</code> is zero-initialized)</p>
  </li>
  <li><p><code>new D</code>    - default-initializes <code>D</code> (<code>D::m</code> is uninitialized, <code>D</code> is non-POD)</p>
  </li>
  <li><p><code>new D()</code>  - value-initializes <code>D</code>, which calls the default ctor (<code>D::m</code> is uninitialized)</p>
  </li>
  <li><p><code>new E</code>    - default-initializes <code>E</code>, which calls the comp. gen. ctor. (<code>E::m</code> is uninitialized, E is non-POD)</p>
  </li>
  <li><p><code>new E()</code>  - value-initializes <code>E</code>, which zero-initializes <code>E</code> since 2 point in <em>[dcl.init]/8</em> )</p>
  </li>
  <li><p><code>new F</code>    - default-initializes <code>F</code>, which calls the comp. gen. ctor. (<code>F::m</code> is uninitialized, <code>F</code> is non-POD)</p>
  </li>
  <li><p><code>new F()</code>  - value-initializes <code>F</code>, which <strong>default-initializes</strong> <code>F</code> since 1. point in <em>[dcl.init]/8</em> (<code>F</code> ctor function is user-provided if it is user-declared and not explicitly defaulted or deleted on its first declaration. <a href="https://stackoverflow.com/questions/26699720/value-initialization-default-initialization-or-zero-initialization#comment47663175_26699720">Link</a>)</p>
  </li>
  </ul>