You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8926252
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/cpp/storage-classes-cpp.md
+10-13Lines changed: 10 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,10 @@ A *storage class* in the context of C++ variable declarations is a type specifie
43
43
44
44
1. The [mutable](../cpp/mutable-data-members-cpp.md) keyword may be considered a storage class specifier. However, it is only available in the member list of a class definition.
45
45
46
-
2. Starting with Visual C++ 2010, the `auto` keyword is no longer a C++ storage-class specifier, and the `register` keyword is deprecated.
46
+
2.**Visual C++ 2010 and later:** The `auto` keyword is no longer a C++ storage-class specifier, and the `register` keyword is deprecated. **Visual Studio 2017 version 15.3 and later:**(available with [/std:c++latest](../build/reference/std-specify-language-standard-version.md)) The `register` keyword is no longer a supported storage class. The keyword is still reserved in the standard for future use.
47
+
```cpp
48
+
registerint val; // warning C5033: 'register' is no longer a supported storage class
49
+
```
47
50
48
51
## In this section:
49
52
@@ -234,18 +237,12 @@ void DoSomething()
234
237
For more information, see [Thread Local Storage (TLS)](../parallel/thread-local-storage-tls.md).
235
238
236
239
## <aname="register"></a> register
237
-
In C++11, the `register` keyword is deprecated. It specifies that the variable is to be stored in a machine register, if possible. Only function arguments and local variables can be declared with the register storage class.
238
-
239
-
```
240
-
register int num;
241
-
```
242
-
243
-
Like automatic variables, register variables persist only until the end of the block in which they are declared.
244
-
245
-
The compiler does not honor user requests for register variables; instead, it makes its own register choices when global optimizations are on. However, all other semantics associated with the `register` keyword are honored by the compiler.
246
-
247
-
If the address-of operator (**&**) is used on an object that is declared with register, the compiler must put the object in memory rather than a register.
248
-
240
+
**Visual Studio 2017 version 15.3 and later:**(available with [/std:c++latest](../build/reference/std-specify-language-standard-version.md)) The `register` keyword is no longer a supported storage class. The keyword is still reserved in the standard for future use.
241
+
242
+
```cpp
243
+
registerint val; // warning C5033: 'register' is no longer a supported storage class
244
+
```
245
+
249
246
## Example: automatic vs. static initialization
250
247
A local automatic object or variable is initialized every time the flow of control reaches its definition. A local static object or variable is initialized the first time the flow of control reaches its definition.
0 commit comments