Question

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

#pragma pack(push,8)
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top