Is sizeof() recursive?
c++, sizeof, struct
Solution
Yes... `sizeof` gives a total of all the members directly included in the type, including `struct`/`class` data members, non-virtual base classes, some implementation-defined links/counters tracking virtual bases, virtual dispatch table pointers, padding that helps align data members for CPU-safe or -efficient access, and theoretically anything else the implementation may feel like putting in there! (for example, something for run-time debugging / error detection, non-Standard support of garbage collection...)
Of course, it doesn't include the size of pointed-to or referenced objects, but does include the size of those pointers and references.
Problem
The answer should be simple, but I wanted to make sure. Is `sizeof()` recursive? For instance, ``` struct foo { DWORD a; DWORD b; }; struct bar { DWORD c; foo d; }; ``` would a `sizeof(bar)` include the size of `foo`, returning a full 12 bytes (assuming DWORD is 4 bytes)?