Edit

Share via


Compiler warning (level 1) C5033

'storage-class-keyword' is no longer a supported storage class

The auto and register storage class keywords have been deprecated or removed from the C++ language.

Remarks

Visual Studio 2010 and later: In C++11, the auto keyword is no longer a C++ storage-class specifier, and the register keyword is deprecated.

Visual Studio 2017 version 15.7 and later: (available in /std:c++17 mode and later): The register keyword is removed from the C++ language in C++17 and later standards.

The C++ standard defines an original and a revised meaning for the auto keyword. Before C++11, the auto keyword declares a variable in the automatic storage class; that is, a variable that has a local lifetime. Starting in C++11, the auto keyword declares a variable whose type is deduced from the initialization expression in its declaration. For backward compatibility, you can use the /Zc:auto compiler option to control the meaning of the auto keyword.

The register keyword was originally meant as a suggestion to the compiler to place a variable in a register. The keyword was routinely ignored by compilers. Instead, compilers control whether variables are placed in registers to satisfy calling conventions and optimization levels. The register keyword is reserved in the standard for future use.

Example

// c5033.cpp
// compile by using: cl /c /std:c++17 c5033.cpp

register int value; // warning C5033: 'register' is no longer a supported storage class

To fix this issue, remove the register storage-class specifier keyword.

See also

Storage class