CKTIS / C++
register — reserved keyword after removal of the specifier
In C++23, register remains a reserved keyword but is not a permitted storage-class specifier. Its former use in declarations was removed in C++17; migration usually only requires removing register.
Version: C++23; repository compiler flag, production runtime not attested
Syntax
register int value = 7; // historical syntax; ill-formed in C++17 and later
int value = 7; // valid replacementIn C++23, register is an unused keyword reserved for future use. You cannot use it as an ordinary variable name or as a storage-class specifier. The declaration register int value = 7; is ill-formed under the standard.
Historically, register was a storage-class specifier. It was removed in C++17, although the word itself remained reserved. To migrate a formerly valid declaration, remove the specifier while retaining its meaning: int value = 7;. Do not treat register as a modern way to control optimization.
The example shows the corrected code and leaves the invalid declaration in a comment. Its expected output is 7 followed by a newline. A compiler accepting the old syntax as an extension does not make it conforming C++23. The supplied source is an evolving working draft, not a frozen C++23 publication.
Examples
#include <iostream>
int main() {
// register int value = 7;
int value = 7;
std::cout << value << '\n';
}
Result
7
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.