title: What happens if you don't return a value in C++?
body: <p>Yesterday, I found myself writing code like this:</p>
  
  <pre><code>SomeStruct getSomeStruct()
  {
      SomeStruct input;
  
      cin &gt;&gt; input.x;
      cin &gt;&gt; input.y;
  }
  </code></pre>
  
  <p>Of course forgetting to actually return the struct I just created.  Oddly enough, the values in the struct that <em>was</em> returned by this function got initialized to zero (when compiled using g++ that is).  Is this just a coincidence or did another SomeStruct get created and initialized somewhere implicitly?</p>