Josh DuBois wrote:
Just as Ulrich suggested, the typedef of the CRITICAL_SECTION struct was inside a #pragma pack(1) block. On the ppc, this made CRITICAL_SECTIONs always (or very often) get put on 2-byte boundaries.
Aha! ;-) I'd suggest we should try and use pack() as sparingly as possible, e.g. by surrounding only single struct definitions with it. Those large #pragma pack() blocks can be really confusing ...
I didn't expect #pragma pack() to affect the alignment of types - I just thought it would cause structures to take up the minimum required amount of room. Seems it makes both members within a structure _and_ separate structures get tightly packed. Or so I gather.
This is really the same thing. The alignment requirement of a structure is the maximum (well, least common multiple) of the alignment requirements of all its member. #pragma pack(1) says that for all subsequent struct definitions, every member's alignment requirement is artificially set to 1. Hence, the struct's alignment requirement is also 1 ...
Bye, Ulrich