title: MSVC 2008 16 Bytes structure members alignment weirdness
body: <p>Can anybody please explain what's going on?</p>
  
  <p>My <strong>MSVC 2008</strong> project's <strong>structure member alignment</strong> setting is set to <strong>16 bytes</strong> (/Zp16) alignment, however one of the following structures is being aligned by <strong>16 bytes</strong> and another is aligned only by <strong>8 bytes</strong>... <strong>WHY?!!!</strong></p>
  
  <pre><code>struct HashData
  {
      void *pData;
      const char* pName;
      int crc;
      bool bModified;
  }; // sizeof (HashData) == 4 + 4 + 4 + 1 + padding = 16 bytes, ok
  
  class StringHash
  {
      HashData data[1024];
      int mask;
      int size;
  }; // sizeof(StringHash) == 1024 * 16 + 4 + 4 + 0 = 16392 bytes, why not 16400 bytes?
  </code></pre>
  
  <p>This may not look like a big deal, but it's a big problem for me, since I am forced to emulate the <strong>MSVC</strong> structures alignment in <strong>GCC</strong> and specifying the <strong>aligned(16)</strong> attribute makes the <strong>sizeof (StringHash) == 16400</strong>!</p>
  
  <p>Please tell me, when and why <strong>MSVC</strong> overrides the <strong>/Zp16</strong> setting, I absolutely can't fathom it...</p>