What this C++ atomics question tests
This is a hard language-knowledge question that probes deep understanding of C++ atomic semantics and the guarantees the standard library provides. Firms like Quant ask it to confirm that candidates know which operations are atomic-safe and which are not—a critical distinction in low-latency systems where unsynchronized access can silently corrupt state.
The question challenges you to reason about the atomic types and their supported member functions. Not all operations on an atomic variable are atomic; some require external synchronization, and some are simply not defined for certain types. A strong answer distinguishes between what syntactically compiles and what the standard guarantees to execute atomically.
- Atomic member functions and their availability by type
- Load, store, and compare-and-swap semantics
- Memory ordering and synchronization guarantees
- Operations that require locks or are undefined