Possible Duplicate:
GCC __attribute__((aligned(x)) explanation
What is meaning of the ‘_attribute_((aligned(4)));’ in the first line?
What does these two pieces of code mean? In particular, the __attribute__ ((aligned(..))) parts.
struct my_struct {
int64_t a;
int64_t b;
} __attribute__ ((aligned(16)));
and
struct my_struct2 { double arr[4] __attribute__((aligned(64))); };
CPU registers often point to memory.
When you increment a register, it points 64 bits further on a 64 bit machine.
However, if you want to get to a byte inside that section, the compiler has to do more work.
If you align memory on the “edges” of memory, the registers can access them much faster. It also means structure members are padded so some space is wasted. If you do a memory dump of the structure, you may be surprised at the padding.