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

A function takes `int*` and `unsigned*` and writes through both. Under the strict aliasing rule, what is the compiler permitted to assume about whether these two pointers alias?

int f(int* i, unsigned* u) { *i = 1; *u = 2; return *i; // can the compiler fold this to 'return 1'? }