title: How is a bool represented in memory?
body: <p>As already discussed <a href="http://www.cplusplus.com/doc/tutorial/variables/" rel="noreferrer">in the docs</a>, a <code>bool</code> data type occupies at least a byte of memory. A similar question was asked on SO before (<a href="https://stackoverflow.com/questions/7967924/how-a-bool-type-variable-is-stored-in-memory-c">How a bool type variable is stored in memory? (C++)</a>), but this discussion and the documentation only seem to discuss the amount of space occupied by a boolean data type, not what actually happens <em>in memory</em> when I do this:</p>
  
  <p><code>bool b = true;</code></p>
  
  <p>So what does actually happen in memory? What happens to the 7 bits that are not used in storing this information? Does the standard prescribe behavior for this?</p>
  
  <p>Are they undefined? Or did someone at C++ headquarters just do this:</p>
  
  <pre><code>enum bool : char 
  {
    false = 0,
    true = 1
  };
  </code></pre>