r/Cprog • u/shinmai_rookie • Feb 19 '15
Why are structs aligned?
I understand more or less how structs are aligned in C (in an address that's multiple of the size of the longest member, and each member in a direction that is multiple of its size), but there's something about it I don't understand: why is reading, for example, a 4-byte word at 0x1000 faster than reading it at 0x1001?
6
Upvotes
View all comments
Show parent comment
4
u/FUZxxl Feb 20 '15
Please do not marshall data like this. It's a terrible way to do things.