What this C++ memory-layout question tests
This is an easy question about how C++ allocates and sizes shared objects in memory. It appears regularly in quant interviews because traders and systems engineers need to reason precisely about memory footprints—especially when designing low-latency data structures or inter-process communication buffers.
To answer correctly, you need to understand how the compiler lays out class members, respects alignment rules on a 64-bit architecture, and accounts for any special properties of shared objects. The question rewards careful attention to the C++ memory model rather than deep algorithmic insight.
- Struct and class layout, padding, and alignment
- Effect of access specifiers and inheritance on size
- Platform-specific pointer and integer widths