title: Unexpected behavior on adding '\0' to std::string
body: <p>Why does the C++ standard allow the following?</p>
  
  <pre class="lang-cxx prettyprint-override"><code>#include &lt;iostream&gt;
  #include &lt;string&gt;    
  
  int main()
  {
      std::string s(10, '\0'); // s.length() now is 10
      std::cout &lt;&lt; "string is " &lt;&lt; s &lt;&lt; ", length is " &lt;&lt; s.length() &lt;&lt; std::endl;
      s.append(5, '\0'); // s.length() now is 15 
      std::cout &lt;&lt; "string is " &lt;&lt; s &lt;&lt; ", length is " &lt;&lt; s.length() &lt;&lt; std::endl;
      // the same with += char and push_back 
  
      // but:
      s += "hello"; // s.length() returns 20 string is "hello"
      std::cout &lt;&lt; "string is " &lt;&lt; s &lt;&lt; ", length is " &lt;&lt; s.length() &lt;&lt; std::endl;
  
      return 0;
  }
  </code></pre>
  
  <p>Why does it add 0 and count it?
  It looks like broken integrity of string, doesn't it? But I checked standard and it is correct behavior.</p>