title: C++ - Defining 1 Bit Bools
body: <p>What are the consequences of defining a structure as follows:</p>
  
  <pre><code>typedef struct {
      bool          Bit0 : 1;    //Bit 0
      bool          Bit1 : 1;
      bool          Bit2 : 1;
      bool          Bit3 : 1;
      bool          Bit4 : 1;
      bool          Bit5 : 1;
      bool          Bit6 : 1;
      bool          Bit7 : 1;     //Bit 7
      char          SomeOtherData;
  }Char16Bits;
  
  ...
  
  Char16Bits MyStructure;
  
  MyStructure.Bit0 = true;
  MyStructure.Bit1 = false;
  </code></pre>
  
  <p>In my test program everything seems fine, each of the "Bit0-7" only occupies 1 bit and I can see them in memory working as expected. The "SomeOtherData" char appears to be the second byte of the structure in memory when looking at the VS2010 Memory window which is all good.</p>
  
  <p>However, can I reliably assume that each of these bits will always only occupy 1 bit? If I memcpy 2 bytes into this structure, will the 2nd byte always reliably occupy the "SomeOtherData" char element in my structure?</p>