This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/31176] reorder class data members to minimize space waste
- From: "sebor at roguewave dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Mar 2007 19:04:20 -0000
- Subject: [Bug c++/31176] reorder class data members to minimize space waste
- References: <bug-31176-1186@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from sebor at roguewave dot com 2007-03-14 19:04 -------
(In reply to comment #1)
> Interesting. Do the attributes apply to derived classes automatically?
I would say no.
>
[...]
> Is D also allowed to reorder members a and b? even with an explicit
> __attribute__((reorder))?
I'm afraid I don't know enough to give an informed answer but my gut tells me
that it might be safer to have the programmer explicitly ask for the base class
padding to be used to store members of the derived class (e.g., via some
creative application of the attribute in the definition of the derived class)
rather than having the compiler do it automatically for them.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31176