05-18-2010, 01:25 PM
Probably in C it is declared with pragma pack 1 or 2.
Then in QM you have to explicitly set offsets.
You should set offsets of all members to make sure that size of type is correct.
Macro Macro1377
Recommended reading: "Structure member alignment; unions" in QM Help.
This explicit offset setting feature is good for unions, but not convenient for types like this. I'll probably add something like pragma pack in next QM. Maybe #opt pack 1 or similar.
Then in QM you have to explicitly set offsets.
You should set offsets of all members to make sure that size of type is correct.
Macro Macro1377
type EXPORT_222 byte'code[8] byte'name[10] int'total int'next
EXPORT_222 e222
out "%i %i %i" &e222.total-&e222 &e222.next-&e222 sizeof(EXPORT_222)
;-------------------
type EXPORT_223 byte'code[8] byte'name[10] [+10]int'total [+4]int'next
EXPORT_223 e223
out "%i %i %i" &e223.total-&e223 &e223.next-&e223 sizeof(EXPORT_223)
;-------------------
type EXPORT_224 [0]byte'code[8] [+8]byte'name[10] [+10]int'total [+4]int'next
EXPORT_224 e224
out "%i %i %i" &e224.total-&e224 &e224.next-&e224 sizeof(EXPORT_224)
Recommended reading: "Structure member alignment; unions" in QM Help.
This explicit offset setting feature is good for unions, but not convenient for types like this. I'll probably add something like pragma pack in next QM. Maybe #opt pack 1 or similar.