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

Why can a compiler keep `*p` cached in a register across the store `*q = ...` in this function, assuming default strict-aliasing?

int g(int* p, float* q) { int x = *p; *q = 7.0f; return x + *p; // *p reloaded? }