Boost logo

Boost :

From: Jean-Francois Bastien (jfbastien_at_[hidden])
Date: 2007-10-02 17:16:23

> It does. It says that members of a struct or class (even
> non-POD ones, which I think is a useless restriction) that
> have no intervening access specifier are stored in memory in
> the same order as they are declared.


> What I personally don't understand is why private members -
> or in fact all members of non-PODs - can't always be
> re-ordered. It's not like anyone should ever depend on their
> order. It probably was C compatibility that there were any
> guarantees at all.

Binary compatibility is one reason: you need a guideline that allows
compilers to agree on class layout. It's a pain, but it's necessary if
ever you're to compile a .h in two separate places (and even in two
different compiler versions, to some extent) and have the same class


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