3 ms·
> Why is it UB to use registers to store variables? It isn't; that sentence is even a type error. UB is not a property of compiler output. It's a property of c
by puffoflogic 5y ago
> Why is it UB to use registers to store variables?
It isn't; that sentence is even a type error. UB is not a property of compiler output. It's a property of compiler input.
The use of registers to store variables between uses (when those variables never have their address taken) relies on the lack of any defined behavior which would allow the program to determine this is being done. The fact you can't find this in the spec is precisely because it is not defined.