Archived

This topic is now archived and is closed to further replies.

Registers

This topic is 5380 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve been looking into registers a bit, to see if it is possible to speed up some game code. Apparently, one can use the Register keyword to request that a certain variable be stored in a register. This sounds like it would come in handy with some often-accessed variables. Yet, MSDN has the following to say about this:
quote:
MSDN C++ language reference: the Register keyword 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.
So... does this mean the Register keyword is useless in Visual Studio? What "other semantics" are there, associated with the register keyword? And what does global register-allocation optimization do?

Share this post


Link to post
Share on other sites
It means exactly what it says, register is an outdated keyword and most (if not all) modern compilers totally ignore it. Global-register-allocation just means that the compiler knows better than the programmer which values are going to be in which registers at any particular time

Share this post


Link to post
Share on other sites
register is nowadays seen like "please compiler, if u could put this in a register it would be cool", but it is definetely not seen (by the compilers) as an order... it''s more like a request when not ignored...

Share this post


Link to post
Share on other sites