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

2.2k Views Asked by At

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?

1

There are 1 best solutions below

0
On

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: