roger
Penultimate Amazing
- Joined
- May 22, 2002
- Messages
- 11,466
No, register is deprecated in practice, and the next C++ standard officially deprecates it. I don't think any modern compiler implements it. Maybe some Cray compiler does.However, I'm assuming (perhaps wrongly) that the compiler will respect the declaration if at all possible.
caveat: register forbids you from taking the address of the variable, and that is enforced by the compiler. But they absolutely do not pass on the information to the assembly code generator pass - it already optimizes for this sort of thing, and does it better than you can.
For example, Microsoft documentation states:
The compiler does not accept user requests for register variables; instead, it makes its own register choices when global register-allocation optimization (/Oe option) is on. However, all other semantics associated with the register keyword are honored.