Class Object layout in memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How does the GNU compiler (2.96 or 3.3 or PPC) layout instances of C++ class objects in memory? For example,
class CMyClass{
private:
int a;
char b;
short c:
};

CMyClass instance;

if &instance is 0x1000, would the memory layout be as follows? Or is it more complex? (Of course the items may be aligned to the processors alignment boundaries ie 32-bit)

instance a b c
0x1000 0x1000 0x1004 0x1005


Joe Lovelace
Winnipeg MB, Canada



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux