Storage of Class-Member Data

Nonstatic class-member data is stored such that items falling between access specifiers are stored at successively higher memory addresses. No ordering across access specifiers is guaranteed.

Microsoft Specific

Depending on the /Zp compilation option, or the pack pragma, intervening space can be allocated to align member data on word or double-word boundaries. (For more information about the /Zp compilation option or the pack pragma, see Chapter 13, “Preprocessing.”)

In Microsoft C++, class-member data is stored at successively higher memory addresses, even though the C++ language does not require it. Basing assumptions on this ordering can lead to nonportable code.¨