Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2000-04-28 06:54:49


>Too bad about the object size bloat. I'm _fairly_ certain that the empty
base class optimization allows the extra size to be removed, but as we all
know not every compiler implements every optimization ;(

Too true, however it's harder in this case, consider:

struct D : public B1, public B2


D d;

can the expression:

(void*)(B1*)(&d) == (void*)(B2)(&d)

ever be true?

If B1 and B2 share a common non-virtual base class then this must not be
true and the base classes (probably) can't be zero sized [10.5p10 and
5.10], but what happens if they don't share a common ancestor? Probably
they can be zero sized, but I don't know of any compilers that implement
this, it would be interesting to have some compiler implementor's
perspective on this....

- John

Boost list run by bdawes at, gregod at, cpdaniel at, john at