View Single Post
  #3  
Old 08-19-2005, 16:51
Mkz Mkz is offline
Friend
 
Join Date: Jan 2002
Posts: 98
Rept. Given: 0
Rept. Rcvd 2 Times in 2 Posts
Thanks Given: 5
Thanks Rcvd at 25 Times in 17 Posts
Mkz Reputation: 2
Just to make sure you know the *reason*:

After "m_uImageType" and before "m_sColorMapStart", the compiler inserted a padding "0", so that the 2-byte-wide "m_sColorMapStart" will be stored at an address which is a multiple of 2. If you had a DWORD, the compiler would pad with zeroes until the address would be a multiple of 4, and so on.

The pragma directive will tell the compiler not to bother aligning the structures.

If you follow the address of each structure member and add the length of the padding zeroes where they are "needed", you'll see that the total length is 20.
Reply With Quote