2 ms·
Of course you can have a pointer to a local variable, and that variable can still spend portions of its lifetime in a register. What won't necessarily work as
by kazinator 8y ago
Of course you can have a pointer to a local variable, and that variable can still spend portions of its lifetime in a register.
What won't necessarily work as expected is a shadily obtained pointer to a local variable, like by displacing &i to try to point to the same location as &j.
If &j doesn't occur anywhere (or does occur, but in a way that is optimized away), j may not even have a location.
- jcranmer 8y agoHow do you reflect the fact that pulling a pointer to a value "out of thin air" may not make any sense without either banning it entirely or defining some step of the process to be undefined behavior?