title: structure padding on 64bit machine
body: <pre><code>struct A
  {
      uint32_t var1;
      uint32_t var2;
      uint32_t var3;
      uint32_t var4;
      uint32_t var5;
  };
  </code></pre>
  
  <p>In the above structure compiler does not pad and allocates 20 bytes.</p>
  
  <p>now we have another structure which contains one 8 byte variable instead of two 4 bytes.In this case compiler pads and allocates 24 bytes to this structure.</p>
  
  <pre><code>struct B
  {
      uint32_t var1;
      uint32_t var2;
      uint32_t var3;
      uint64_t var5;
  };
  </code></pre>
  
  <p>why there is such behaviour? 
  If compiler align the data into 8 byte boundry then there should be padding of 4 bytes in the 1st structure and should 
  not pad the 2nd structure in such case. and also if compiler align the data into the 4 byte boundry then why there is padding of 4 byte in the 2nd structure ?</p>
  
  <p>compiler: GCC 
  Platform: 64 bit linux , x86_64</p>