![]() |
|
|
|
#1
|
|||
|
|||
|
Try with
#paragma pack(1) (or Intel 8.0 equivalent) directive to have alignment set to 1. Tom |
|
#2
|
|||
|
|||
|
Seems to work, thx.
Guess i need to learn my tools
|
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
Quote:
#pragma pack(push, 1) struct ... {}; #pragma pack(pop) to avoid pack problems with other structures
|
|
#5
|
|||
|
|||
|
could be a good reading
http://blogs.msdn.com/larryosterman/archive/2005/04/07/406252.aspx there is a part 2 too |
|
#6
|
|||
|
|||
|
Quote:
#include <PshPack1.h> struct ... {}; #include <PopPack.h> |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How come new registrants given "guest" rank and not even a "friend" rank? | OldieHans | General Discussion | 4 | 09-25-2023 12:19 |
| When use "vendor defined encryption routines", how to set daemon related part? | bridgeic | General Discussion | 6 | 01-22-2015 11:35 |
| Wlscgen: Are "Vendor Id" and "Developer Id" different ? | Numega Softice | General Discussion | 6 | 02-12-2007 18:12 |