When should I use pragma pack?
When should I use pragma pack?
I found this code on some source files while other sources do not have the pragma pack() Code:
#pragma pack (1) |
The use of pragma pack is to ensure that the data structure is byte-aligned versus word-aligned. For example, the following struct takes up 8 bytes (perhaps not on all systems), but on typical Linux machines:
Code:
struct Foo |
All times are GMT -5. The time now is 10:39 PM. |