8
votes

What does the following statement actually do and what are it's effects?

#pragma pack(push,8)
1

1 Answers

14
votes

It pushes the current pack setting onto a stack (so that you can restore it later via pop) and then sets the alignment for struct elements to 8 bytes. Anything which is not naturally aligned to an 8 byte boundary will have padding bytes inserted before it to maintain the required alignment.