Reputation: 301
is there a difference between
__attribute__((__packed__))
and
__attribute__((packed))
?
And if a struct is packed like this:
struct test { int a; short b; } __attribute__((__packed__))
there is never a need to use the packed attribute on each of the members of the struct, because when the struct is packed, all members are always packed, too. Is this correct?
Upvotes: 2
Views: 2434
Reputation: 25340
No, both are equal. The leading and trialing __
of a keyword are optional, so you can use your attribute in headers, "without being concerned about a possible macro of the same name."
Source:
Upvotes: 2