Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++strict aliasing rulesSingle-choice MCQ

Which statement about how `std::memcpy`-based type punning interacts with strict aliasing and the object model is correct?

float f = 1.0f; unsigned u; std::memcpy(&u, &f, sizeof u); // read u afterwards