<p>The C++ standard imposes an ordering on class member variables in memory.  It says that the addresses of member variables have to increase in the order of declaration, but only inside one access section.  Very specifically, this does not seem to prevent compilers from laying out access sections in an interleaved way.  For example:</p>

<pre><code>class X {
public:
   int i;
   int j;
private:
   int k;
   int n;
}
</code></pre>

<p>Does the standard allow compilers to lay out the data members in the order i, k, j, n?  This would give compilers some (limited) freedom in optimizing object layout without violating the standard.</p>

And no, i think he is NOT trying to spam. This is a valid question and quite interesting i think.
Ok now i think compilers can do that. The standard says in 9.2. p12:
```
Implementation alignment require-
ments might cause two adjacent members not to be allocated immediately after each other; so might
requirements for space for managing virtual functions (10.3) and virtual base classes (10.1).
```