Reputation: 167
Is there any difference between attribute((packed,aligned(n))) and attribute((aligned(n))) ?
Upvotes: 2
Views: 435
Reputation: 185831
The aligned
attribute specifies the minimum alignment the variable/field must have. The packed
attribute requests that the variable/field should have the smallest possible alignment. So just using __attribute__((aligned(n))
sets the minimum alignment to n
, but does not guarantee that it won't be larger. But using __attribute__((packed,aligned(n)))
sets the alignment to precisely n
.
Upvotes: 2