I am trying to understand the types of POD and how they are allocated and initialized on the stack. Considering,
class A { public: A(); int x; }; class B { public: int x; }; int func() { A a; B b; }
Am I saying correctly that b stands out after, but initializes to a? By this I mean that the space is allocated for a and b in the order in which they are declared, but b is initialized when the space is allocated and a is initialized when it is declared?
I read the very good POD FAQ and compiled here What are aggregates and PODs and how / why are they special?
One of the things he said: The lifetime of non-POD class objects begins when the constructor completes and finishes working with the completion of the destructor. For POD classes, the lifetime begins when the storage for the object is busy and ends when this storage is released or reused.
So, I'm trying to understand the details of how PODs are allocated and initialized, and how they are different from non-PODs.
source share