[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Pierre Phaneuf wrote:
> We used structs in both (Win32 and Linux) versions of Quadra, and both
> platforms do word alignment. There is a compiler pragma that works on
> both Visual C++ and gcc/egcs, "#pragma pack(1)" to start packing and
> "#pragma pack()" to stop.
Huh ? I thought it was the other way around :) From MSDN :
When you use #pragma pack(n), where n is 1, 2, 4, 8, or 16,
each structure member after the first is stored on the smaller
member type or n-byte boundaries. If you use #pragma pack
without an argument, structure members are packed to the
value specified by /Zp. The default /Zp packing size is /Zp8.
So pack (1) would disable packing because it "packs" to 1 byte,
and pack () would restore whatever you had by default, which is
8 bytes for VC++. Or am I missing something :)
-=<Short Controlled Bursts>=-