user3035952
user3035952

Reputation: 301

__attribute__((packed)) and __attribute__((__packed__))

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

Answers (1)

ollo
ollo

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

Related Questions