Skip to content

Commit 293bdf4

Browse files
author
3836425+corob-msft@users.noreply.github.com
committed
Address 3462 add C5033 warning
1 parent ab584bd commit 293bdf4

6 files changed

Lines changed: 65 additions & 26 deletions

File tree

docs/build/reference/og-global-optimizations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "/Og (Global Optimizations)"
33
description: "Describes the deprecated MSVC compiler option /Og, formerly used to enable global optimizations."
4-
ms.date: 07/08/2020
4+
ms.date: 10/19/2021
55
f1_keywords: ["VC.Project.VCCLCompilerTool.GlobalOptimizations", "/og"]
66
helpviewer_keywords: ["-Og compiler option [C++]", "global optimizations compiler option [C++]", "automatic register allocation", "/Og compiler option [C++]", "loop structures, optimizing", "common subexpression elimination", "Og compiler option [C++]"]
77
ms.assetid: d10630cc-b9cf-4e97-bde3-8d7ee79e9435
@@ -34,7 +34,7 @@ The following optimizations are available under **`/Og`**:
3434

3535
- Automatic register allocation
3636

37-
This optimization allows the compiler to store frequently used variables and subexpressions in registers; the **`register`** keyword is ignored.
37+
This optimization allows the compiler to store frequently used variables and subexpressions in registers. The **`register`** keyword is ignored by default, and causes a diagnostic under **`/std:c++17`** or later.
3838

3939
- Loop optimization
4040

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
description: "Learn more about: register Storage-Class Specifier"
3-
title: "register Storage-Class Specifier"
4-
ms.date: "11/04/2016"
2+
description: "Learn more about: register storage-class specifier"
3+
title: "register storage-class specifier"
4+
ms.date: 10/19/2021
55
helpviewer_keywords: ["register variables", "register storage class"]
66
ms.assetid: 7577bf48-88ec-4191-873c-ef4217a4034e
77
---
8-
# register Storage-Class Specifier
8+
# `register` storage-class specifier
99

1010
**Microsoft Specific**
1111

12-
The Microsoft C/C++ compiler does not honor user requests for register variables. However, for portability all other semantics associated with the **`register`** keyword are honored by the compiler. For example, you cannot apply the unary address-of operator (**&**) to a register object nor can the **`register`** keyword be used on arrays.
12+
The Microsoft C/C++ compiler doesn't honor user requests for register variables. However, for portability all other semantics associated with the **`register`** keyword are honored by the compiler. For example, you can't apply the unary address-of operator (**`&`**) to a register object nor can the **`register`** keyword be used on arrays.
1313

1414
**END Microsoft Specific**
1515

1616
## See also
1717

18-
[Storage-Class Specifiers for Internal-Level Declarations](../c-language/storage-class-specifiers-for-internal-level-declarations.md)
18+
[Storage-class specifiers for internal-level declarations](../c-language/storage-class-specifiers-for-internal-level-declarations.md)

docs/cpp/storage-classes-cpp.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Storage classes (C++)"
33
description: "In C++, the static, extern and thread_local keywords specify the lifetime, linkage, and memory location of a variable or function."
4-
ms.date: "12/11/2019"
4+
ms.date: 10/19/2021
55
f1_keywords: ["thread_local_cpp", "static_cpp", "register_cpp"]
66
helpviewer_keywords: ["storage classes [C++], basic concepts"]
77
ms.assetid: f10e1c56-6249-4eb6-b08f-09ab1eef1992
@@ -10,15 +10,17 @@ ms.assetid: f10e1c56-6249-4eb6-b08f-09ab1eef1992
1010

1111
A *storage class* in the context of C++ variable declarations is a type specifier that governs the lifetime, linkage, and memory location of objects. A given object can have only one storage class. Variables defined within a block have automatic storage unless otherwise specified using the **`extern`**, **`static`**, or **`thread_local`** specifiers. Automatic objects and variables have no linkage; they are not visible to code outside the block. Memory is allocated for them automatically when execution enters the block and de-allocated when the block is exited.
1212

13-
**Notes**
13+
## Notes
1414

15-
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.
15+
- 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.
1616

17-
1. **Visual Studio 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.7 and later:** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is removed from the C++ language.
17+
- **Visual Studio 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.7 and later:** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is removed from the C++ language. Its use causes a diagnostic message:
1818

19-
```cpp
20-
register int val; // warning C5033: 'register' is no longer a supported storage class
21-
```
19+
```cpp
20+
// c5033.cpp
21+
// compile by using: cl /c /std:c++17 c5033.cpp
22+
register int value; // warning C5033: 'register' is no longer a supported storage class
23+
```
2224

2325
## <a name="static"></a> `static`
2426

@@ -186,7 +188,7 @@ On Windows, **`thread_local`** is functionally equivalent to [`__declspec(threa
186188

187189
## <a name="register"></a> register
188190

189-
**Visual Studio 2017 version 15.3 and later** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is no longer a supported storage class. The keyword is still reserved in the standard for future use.
191+
**Visual Studio 2017 version 15.3 and later** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is no longer a supported storage class. Its use causes a diagnostic. The keyword is still reserved in the standard for future use.
190192

191193
```cpp
192194
register int val; // warning C5033: 'register' is no longer a supported storage class
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "Compiler Warning C5033"
3+
description: Describes the causes and fixes for compiler warning C5033.
4+
ms.date: 05/03/2021
5+
f1_keywords: ["C5033"]
6+
helpviewer_keywords: ["C5033"]
7+
---
8+
# Compiler Warning (Level 1) C5033
9+
10+
> '*storage-class-keyword*' is no longer a supported storage class
11+
12+
Certain storage class keywords have been deprecated or removed from the C++ language.
13+
14+
## Remarks
15+
16+
**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.
17+
18+
**Visual Studio 2017 version 15.7 and later:** (available in [`/std:c++17`](../build/reference/std-specify-language-standard-version.md) mode and later): The **`register`** keyword is removed from the C++ language in C++17 and later standards.
19+
20+
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`](../../build/reference/zc-auto-deduce-variable-type.md) compiler option to control the meaning of the **`auto`** keyword.
21+
22+
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.
23+
24+
## Example
25+
26+
```cpp
27+
// c5033.cpp
28+
// compile by using: cl /c /std:c++17 c5033.cpp
29+
30+
register int value; // warning C5033: 'register' is no longer a supported storage class
31+
```
32+
33+
To fix this issue, remove the **`register`** storage-class specifier keyword.
34+
35+
## See also
36+
37+
[Storage class](../../cpp/storage-classes-cpp.md)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
22
description: "Learn more about: Compiler Warning (level 4) C4710"
33
title: "Compiler Warning (level 4) C4710"
4-
ms.date: "11/04/2016"
4+
ms.date: 10/19/2021
55
f1_keywords: ["C4710"]
66
helpviewer_keywords: ["C4710"]
77
ms.assetid: 76381ec7-3fc1-4bee-9a0a-c2c8307b92e2
88
---
99
# Compiler Warning (level 4) C4710
1010

11-
'function' : function not inlined
11+
> '*function*' : function not inlined
1212
13-
The given function was selected for inline expansion, but the compiler did not perform the inlining.
13+
The specified function was marked for inline expansion, but the compiler didn't inline the function.
1414

15-
Inlining is performed at the compiler's discretion. The **`inline`** keyword, like the **`register`** keyword, is used as a hint for the compiler. The compiler uses heuristics to determine if it should inline a particular function to speed up the code when compiling for speed, or if it should inline a particular function to make the code smaller when compiling for space. The compiler will only inline very small functions when compiling for space.
15+
Inlining is done at the compiler's discretion. The **`inline`** keyword, like the deprecated (and, in C++17 and later standards, removed) **`register`** keyword, is used as a hint for the compiler. The compiler uses heuristics to determine if it should inline a particular function to speed up the code when it optimizes for speed, or if it should inline a particular function to make the code smaller when it optimizes for space. The compiler inlines only the smallest functions when compiling for space.
1616

17-
In some cases, the compiler will not inline a particular function for mechanical reasons. See [C4714](../../error-messages/compiler-warnings/compiler-warning-level-4-c4714.md) for a list of reasons the compiler may not inline a function.
17+
In some cases, the compiler doesn't inline a particular function for mechanical reasons. See [C4714](../../error-messages/compiler-warnings/compiler-warning-level-4-c4714.md) for a list of reasons the compiler may not inline a function.
1818

19-
This warning is off by default. See [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md) for more information.
19+
This warning is off by default. For more information, see [Compiler warnings that are off by default](../../preprocessor/compiler-warnings-that-are-off-by-default.md).

docs/error-messages/compiler-warnings/compiler-warnings-c4800-through-c4999.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: "Compiler warnings C4800 Through C5999"
33
description: "Table of Microsoft C/C++ compiler warnings C4800 through C5999."
4-
ms.date: 08/09/2021
5-
f1_keywords: ["C4808", "C4809", "C4825", "C4827", "C4837", "C4842", "C4844", "C4845", "C4846", "C4847", "C4848", "C4854", "C4855", "C4856", "C4857", "C4872", "C4880", "C4881", "C4882", "C4916", "C4921", "C4934", "C4954", "C4955", "C4963", "C4966", "C4970", "C4971", "C4973", "C4974", "C4981", "C4987", "C4988", "C4989", "C4990", "C4991", "C4992", "C4998", "C5022", "C5023", "C5024", "C5025", "C5026", "C5027", "C5028", "C5029", "C5030", "C5031", "C5032", "C5033", "C5034", "C5035", "C5036", "C5039", "C5040", "C5041", "C5042", "C5043", "C5044", "C5047", "C5048", "C5049", "C5051", "C5052", "C5053", "C5054", "C5055", "C5056", "C5057", "C5058", "C5059", "C5060", "C5061", "C5062", "C5063", "C5100", "C5101", "C5102", "C5103", "C5104", "C5106", "C5107", "C5108", "C5200", "C5201", "C5202", "C5203", "C5204", "C5205", "C5206", "C5207", "C5209", "C5210", "C5211", "C5212", "C5213", "C5214", "C5215", "C5216", "C5217", "C5218", "C5219", "C5220", "C5221", "C5222", "C5223", "C5224", "C5225", "C5226", "C5227", "C5228", "C5229", "C5230", "C5231", "C5232", "C5233", "C5234", "C5235", "C5236", "C5237", "C5238", "C5239", "C5240", "C5241", "C5242", "C5244", "C5245", "C5246", "C5249", "C5250"]
6-
helpviewer_keywords: ["C4808", "C4809", "C4825", "C4827", "C4837", "C4842", "C4844", "C4845", "C4846", "C4847", "C4848", "C4854", "C4855", "C4856", "C4857", "C4872", "C4880", "C4881", "C4882", "C4916", "C4921", "C4934", "C4954", "C4955", "C4963", "C4966", "C4970", "C4971", "C4973", "C4974", "C4981", "C4987", "C4988", "C4989", "C4990", "C4991", "C4992", "C4998", "C5022", "C5023", "C5024", "C5025", "C5026", "C5027", "C5028", "C5029", "C5030", "C5031", "C5032", "C5033", "C5034", "C5035", "C5036", "C5039", "C5040", "C5041", "C5042", "C5043", "C5044", "C5047", "C5048", "C5049", "C5051", "C5052", "C5053", "C5054", "C5055", "C5056", "C5057", "C5058", "C5059", "C5060", "C5061", "C5062", "C5063", "C5100", "C5101", "C5102", "C5103", "C5104", "C5106", "C5107", "C5108", "C5200", "C5201", "C5202", "C5203", "C5204", "C5205", "C5206", "C5207", "C5209", "C5210", "C5211", "C5212", "C5213", "C5214", "C5215", "C5216", "C5217", "C5218", "C5219", "C5220", "C5221", "C5222", "C5223", "C5224", "C5225", "C5226", "C5227", "C5228", "C5229", "C5230", "C5231", "C5232", "C5233", "C5234", "C5235", "C5236", "C5237", "C5238", "C5239", "C5240", "C5241", "C5242", "C5244", "C5245", "C5246", "C5249", "C5250"]
4+
ms.date: 10/19/2021
5+
f1_keywords: ["C4808", "C4809", "C4825", "C4827", "C4837", "C4842", "C4844", "C4845", "C4846", "C4847", "C4848", "C4854", "C4855", "C4856", "C4857", "C4872", "C4880", "C4881", "C4882", "C4916", "C4921", "C4934", "C4954", "C4955", "C4963", "C4966", "C4970", "C4971", "C4973", "C4974", "C4981", "C4987", "C4988", "C4989", "C4990", "C4991", "C4992", "C4998", "C5022", "C5023", "C5024", "C5025", "C5026", "C5027", "C5028", "C5029", "C5030", "C5031", "C5032", "C5034", "C5035", "C5036", "C5039", "C5040", "C5041", "C5042", "C5043", "C5044", "C5047", "C5048", "C5049", "C5051", "C5052", "C5053", "C5054", "C5055", "C5056", "C5057", "C5058", "C5059", "C5060", "C5061", "C5062", "C5063", "C5100", "C5101", "C5102", "C5103", "C5104", "C5106", "C5107", "C5108", "C5200", "C5201", "C5202", "C5203", "C5204", "C5205", "C5206", "C5207", "C5209", "C5210", "C5211", "C5212", "C5213", "C5214", "C5215", "C5216", "C5217", "C5218", "C5219", "C5220", "C5221", "C5222", "C5223", "C5224", "C5225", "C5226", "C5227", "C5228", "C5229", "C5230", "C5231", "C5232", "C5233", "C5234", "C5235", "C5236", "C5237", "C5238", "C5239", "C5240", "C5241", "C5242", "C5244", "C5245", "C5246", "C5249", "C5250"]
6+
helpviewer_keywords: ["C4808", "C4809", "C4825", "C4827", "C4837", "C4842", "C4844", "C4845", "C4846", "C4847", "C4848", "C4854", "C4855", "C4856", "C4857", "C4872", "C4880", "C4881", "C4882", "C4916", "C4921", "C4934", "C4954", "C4955", "C4963", "C4966", "C4970", "C4971", "C4973", "C4974", "C4981", "C4987", "C4988", "C4989", "C4990", "C4991", "C4992", "C4998", "C5022", "C5023", "C5024", "C5025", "C5026", "C5027", "C5028", "C5029", "C5030", "C5031", "C5032", "C5034", "C5035", "C5036", "C5039", "C5040", "C5041", "C5042", "C5043", "C5044", "C5047", "C5048", "C5049", "C5051", "C5052", "C5053", "C5054", "C5055", "C5056", "C5057", "C5058", "C5059", "C5060", "C5061", "C5062", "C5063", "C5100", "C5101", "C5102", "C5103", "C5104", "C5106", "C5107", "C5108", "C5200", "C5201", "C5202", "C5203", "C5204", "C5205", "C5206", "C5207", "C5209", "C5210", "C5211", "C5212", "C5213", "C5214", "C5215", "C5216", "C5217", "C5218", "C5219", "C5220", "C5221", "C5222", "C5223", "C5224", "C5225", "C5226", "C5227", "C5228", "C5229", "C5230", "C5231", "C5232", "C5233", "C5234", "C5235", "C5236", "C5237", "C5238", "C5239", "C5240", "C5241", "C5242", "C5244", "C5245", "C5246", "C5249", "C5250"]
77
---
88
# Compiler warnings C4800 through C5999
99

@@ -141,7 +141,7 @@ The articles in this section of the documentation explain a subset of the warnin
141141
| Compiler warning (level 3) C5030 | attribute '*attribute-name*' is not recognized |
142142
| Compiler warning (level 4) C5031 | `#pragma warning(pop)`: likely mismatch, popping warning state pushed in different file |
143143
| Compiler warning (level 4) C5032 | detected `#pragma warning(push)` with no corresponding `#pragma warning(pop)` |
144-
| Compiler warning (level 1) C5033 | '*storage-class*' is no longer a supported storage class |
144+
| [Compiler warning (level 1) C5033](c5033.md) | '*storage-class*' is no longer a supported storage class |
145145
| Compiler warning C5034 | use of intrinsic '*intrinsic*' causes function *function-name* to be compiled as guest code |
146146
| Compiler warning C5035 | use of feature '*feature*' causes function *function-name* to be compiled as guest code |
147147
| Compiler warning (level 1) C5036 | varargs function pointer conversion when compiling with `/hybrid:x86arm64` '*type1*' to '*type2*' |

0 commit comments

Comments
 (0)