What does the register
keyword do in C language? I have read that it is used for optimizing but is not clearly defined in any standard. Is it still relevant and if so, when would you use it?
“register” keyword in C
ckeywordmemory
Related Topic
- Php – What does PHP keyword ‘var’ do
- How to use extern to share variables between source files
- Javascript – the purpose of the var keyword and when should I use it (or omit it)
- Sqlite – Improve INSERT-per-second performance of SQLite
- Ruby – Equivalent of “continue” in Ruby
- What does the ??!??! operator do in C
- C++ – Can code that is valid in both C and C++ produce different behavior when compiled in each language
- R – Drupal: retrieve data from multiple node types in views 2
Best Answer
It's a hint to the compiler that the variable will be heavily used and that you recommend it be kept in a processor register if possible.
Most modern compilers do that automatically, and are better at picking them than us humans.