This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
empty member optimization?
- To: egcs at cygnus dot com
- Subject: empty member optimization?
- From: Nathan Myers <ncm at cygnus dot com>
- Date: Mon, 22 Jun 1998 14:11:22 -0700
- Newsgroups: cygnus.egcs
- Organization: http://www.cantrip.org/
In answer to something Jason posted a couple of weeks ago...
I don't know of anything in the Draft that forbids eliding
storage of empty member objects that are followed by an
access specifier, or at the end of the object:
struct Empty {};
struct Not {
Empty e;
public:
int i;
};
Here members i and e could have the same address. However, it
gets complicated, because in
struct Not2 {
Empty e;
public:
Empty f;
};
struct Not3 : Not2 {
Empty g;
};
You have to make sure e, f, and g have distinct addresses.
But these quibbles don't seem very different from what you
have with empty bases:
struct Not4 : Empty {
Empty h;
};
Nathan Myers
ncm@cygnus.com