C Programming – When Is the Register Keyword Useful?

ckeywords

I am confused about the use of register keyword in C. It is generally told that its use isn't needed like in this question on stackoverflow.

Is this keyword totally redundant in C due to modern compilers or are there situations in which it can still be useful? If yes, what are some situations in which use of register keyword is actually helpful?

Best Answer

It's not redundant in terms of language, it's just that by using it, you're telling the compiler, you would "prefer" to have a variable stored in register. There is however absolutely zero guarantee that this will actually happen during runtime.