Type modifier: register

4

The type modifier register instructs the compiler to store the variable directly in the registers, however I do not see much use of it in codes, this put, I get the following doubts:

In what context is its use recommended and when not to use it

    
asked by anonymous 05.12.2016 / 23:18

1 answer

4

Essentially it is no longer needed. Compilers are able to decide when to put in the register or not, rather than the programmer. Its use may even prevent some optimizations that can bring better benefit. In fact most compilers ignore it if not totally, at least most of the time, unless the optimizations are turned off, there it might be useful, but why would you do that?

    
05.12.2016 / 23:29