Bug 25759 - Documentation not clear, attribute packed on class in C++
Summary: Documentation not clear, attribute packed on class in C++
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: documentation
Depends on:
Reported: 2006-01-12 09:05 UTC by Frank Mehnert
Modified: 2006-02-02 19:51 UTC (History)
1 user (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-02 19:51:35


Note You need to log in before you can comment on or make changes to this bug.
Description Frank Mehnert 2006-01-12 09:05:24 UTC
The gcc manual does not describe the behaviour of __attribute__((packed)) attached to a class definition, e.g.

  class foo
    unsigned char;
    unsigned long;
  } __attribute__((packed));

As far as I have observed, the behaviour is the same if foo would be declared as struct. The gcc manual describes packed only for variables, structs and enums.
Comment 1 Andrew Pinski 2006-01-12 12:53:19 UTC
Class and structs are the same by definition of the C++ standard.  The only different is the default accessibility, private for class and public for struct.
Comment 2 Andrew Pinski 2006-02-02 19:51:35 UTC
Confirmed, more of the issue is really the documenation is more C based than C++ based.