Register keyword in C++

register is a hint to the compiler, advising it to store that variable in a processor register instead of memory (for example, instead of the stack).

The compiler may or may not follow that hint.

According to Herb Sutter in “Keywords That Aren’t (or, Comments by Another Name)”:

A register specifier has the same
semantics as an auto specifier…

Leave a Comment