A colleague told me that, in the following type, all members have unspecified ordering in memory (relative to one another).
I doubt this, because they all have the same access level.
Who is correct?
struct foo { public: int x; public: int y; public: int z; };
The purchase order process consists of all the steps businesses take to create, approve, validate, manage, and track POs, from the moment a need is identified up to the point of delivery or sale.
The shop owner creates a purchase order laying out exactly what they need from the supplier. If the supplier has the inventory to fill the order, they'll accept the purchase order, fulfill it, and deliver the items on the agreed due date. The supplier will then send a bill or sales invoice for the purchased items.
Your colleague is correct for C++03:
[C++03: 9.2/12]:
Nonstatic data members of a (non-union) class declared without an intervening access-specifier are allocated so that later members have higher addresses within a class object. The order of allocation of nonstatic data members separated by an access-specifier is unspecified (11.1). [..]
But you are correct for C++11:
[C++11: 9.2/14]:
Nonstatic data members of a (non-union) class with the same access control (Clause 11) are allocated so that later members have higher addresses within a class object. The order of allocation of non-static data members with different access control is unspecified (11). [..]
(Spot the difference.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With