Understanding virtual method inlining in C++
This is a medium-difficulty C++ knowledge question that trading systems developers encounter during technical interviews. It tests whether you understand the interaction between two of C++'s core mechanisms: virtual dispatch and compiler optimisation.
The question probes deeper than a yes/no answer. Strong candidates explain the conditions under which inlining is possible, the role of the compiler's devirtualisation capabilities, and the practical trade-offs between runtime flexibility and performance predictability. This matters in quantitative finance, where low-latency systems rely on precise control over call overhead and instruction caches.
- Virtual dispatch and dynamic polymorphism
- Compiler devirtualisation and optimisation heuristics
- Inlining constraints and code-generation boundaries
- Performance implications in tight loops