2

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?

user3035952
  • 301
  • 5
  • 12

1 Answers1

2

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:

ollo
  • 24,797
  • 14
  • 106
  • 155