Skip to content

Commit 97652dc

Browse files
author
Colin Robertson
authored
Merge pull request #2518 from MicrosoftDocs/master637376039417978256
Repo sync for protected CLA branch
2 parents 8aec4a2 + 40a02eb commit 97652dc

12 files changed

+164
-156
lines changed

docs/build/reference/rtc-run-time-error-checks.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: "/RTC (Run-time error checks)"
3+
description: "The Microsoft C/C++ compiler /RTC options for run-time error checks."
34
ms.date: 07/31/2020
45
f1_keywords: ["/rtc", "VC.Project.VCCLCompilerTool.SmallerTypeCheck", "VC.Project.VCCLCompilerTool.UninitializedVariableCheck", "VC.Project.VCCLCompilerTool.StackFrameCheck", "VC.Project.VCCLCompilerTool.BasicRuntimeChecks"]
56
helpviewer_keywords: ["/RTCs compiler option [C++]", "-RTC1 compiler option [C++]", "run-time errors, error checks", "-RTCu compiler option [C++]", "/RTC1 compiler option [C++]", "/RTCc compiler option [C++]", "/RTCu compiler option [C++]", "__MSVC_RUNTIME_CHECKS macro", "-RTCs compiler option [C++]", "RTCs compiler option", "RTC1 compiler option", "run-time errors, run-time checks", "run-time checks, /RTC option", "RTCu compiler option", "RTCc compiler option", "-RTCc compiler option [C++]"]
@@ -82,7 +83,7 @@ The `__MSVC_RUNTIME_CHECKS` preprocessor directive will be defined when you use
8283

8384
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
8485

85-
1. Select the **Configuration Properties** > **C/C++** **Code Generation** property page.
86+
1. Select the **Configuration Properties** > **C/C++** > **Code Generation** property page.
8687

8788
1. Modify one or both of the following properties: **Basic Runtime Checks** or **Smaller Type Check**.
8889

docs/build/reference/sdl-enable-additional-security-checks.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
22
title: "/sdl (Enable Additional Security Checks)"
3-
ms.date: "11/26/2018"
3+
description: "The Microsoft C/C++ compiler /sdl option enables recommended Security Development Lifecycle (SDL) checks and warnings."
4+
ms.date: 10/02/2020
45
f1_keywords: ["VC.Project.VCCLCompilerTool.SDLCheck"]
56
ms.assetid: 3dcf86a0-3169-4240-9f29-e04a9f535826
67
---
78
# /sdl (Enable Additional Security Checks)
89

9-
Adds recommended Security Development Lifecycle (SDL) checks. These checks include extra security-relevant warnings as errors, and additional secure code-generation features.
10+
Enables recommended Security Development Lifecycle (SDL) checks. These checks change security-relevant warnings into errors, and set additional secure code-generation features.
1011

1112
## Syntax
1213

@@ -16,53 +17,51 @@ Adds recommended Security Development Lifecycle (SDL) checks. These checks inclu
1617

1718
**/sdl** enables a superset of the baseline security checks provided by [`/GS`](gs-buffer-security-check.md) and overrides **`/GS-`**. By default, **`/sdl`** is off. **`/sdl-`** disables the additional security checks.
1819

19-
## Compile-time Checks
20+
### Compile-time Checks
2021

2122
**`/sdl`** enables these warnings as errors:
2223

23-
|Warning enabled by /sdl|Equivalent command-line switch|Description|
24-
|------------------------------|-------------------------------------|-----------------|
25-
|[C4146](../../error-messages/compiler-warnings/compiler-warning-level-2-c4146.md)|/we4146|A unary minus operator was applied to an unsigned type, resulting in an unsigned result.|
26-
|[C4308](../../error-messages/compiler-warnings/compiler-warning-level-2-c4308.md)|/we4308|A negative integral constant converted to unsigned type, resulting in a possibly meaningless result.|
27-
|[C4532](../../error-messages/compiler-warnings/compiler-warning-level-1-c4532.md)|/we4532|Use of `continue`, `break` or `goto` keywords in a `__finally`/`finally` block has undefined behavior during abnormal termination.|
28-
|[C4533](../../error-messages/compiler-warnings/compiler-warning-level-1-c4533.md)|/we4533|Code initializing a variable will not be executed.|
29-
|[C4700](../../error-messages/compiler-warnings/compiler-warning-level-1-and-level-4-c4700.md)|/we4700|Use of an uninitialized local variable.|
30-
|[C4703](../../error-messages/compiler-warnings/compiler-warning-level-4-c4703.md)|/we4703|Use of a potentially uninitialized local pointer variable.|
31-
|[C4789](../../error-messages/compiler-warnings/compiler-warning-level-1-c4789.md)|/we4789|Buffer overrun when specific C run-time (CRT) functions are used.|
32-
|[C4995](../../error-messages/compiler-warnings/compiler-warning-level-3-c4995.md)|/we4995|Use of a function marked with pragma [`deprecated`](../../preprocessor/deprecated-c-cpp.md).|
33-
|[C4996](../../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md)|/we4996|Use of a function marked as [`deprecated`](../../cpp/deprecated-cpp.md).|
24+
| Warning enabled by /sdl | Equivalent command-line switch | Description |
25+
|--|--|--|
26+
| [C4146](../../error-messages/compiler-warnings/compiler-warning-level-2-c4146.md) | /we4146 | A unary minus operator was applied to an unsigned type, resulting in an unsigned result. |
27+
| [C4308](../../error-messages/compiler-warnings/compiler-warning-level-2-c4308.md) | /we4308 | A negative integral constant converted to unsigned type, resulting in a possibly meaningless result. |
28+
| [C4532](../../error-messages/compiler-warnings/compiler-warning-level-1-c4532.md) | /we4532 | Use of `continue`, `break`, or `goto` keywords in a `__finally`/`finally` block has undefined behavior during abnormal termination. |
29+
| [C4533](../../error-messages/compiler-warnings/compiler-warning-level-1-c4533.md) | /we4533 | Code initializing a variable will not be executed. |
30+
| [C4700](../../error-messages/compiler-warnings/compiler-warning-level-1-and-level-4-c4700.md) | /we4700 | Use of an uninitialized local variable. |
31+
| [C4703](../../error-messages/compiler-warnings/compiler-warning-level-4-c4703.md) | /we4703 | Use of a potentially uninitialized local pointer variable. |
32+
| [C4789](../../error-messages/compiler-warnings/compiler-warning-level-1-c4789.md) | /we4789 | Buffer overrun when specific C run-time (CRT) functions are used. |
33+
| [C4995](../../error-messages/compiler-warnings/compiler-warning-level-3-c4995.md) | /we4995 | Use of a function marked with pragma [`deprecated`](../../preprocessor/deprecated-c-cpp.md). |
34+
| [C4996](../../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md) | /we4996 | Use of a function marked as [`deprecated`](../../cpp/deprecated-cpp.md). |
3435

35-
## Runtime checks
36+
### Runtime checks
3637

37-
When **`/sdl`** is enabled, the compiler generates code to perform these checks at run time:
38+
When **`/sdl`** is enabled, the compiler generates code that does these checks at run time:
3839

3940
- Enables the strict mode of **`/GS`** run-time buffer overrun detection, equivalent to compiling with `#pragma strict_gs_check(push, on)`.
4041

41-
- Performs limited pointer sanitization. In expressions that do not involve dereferences and in types that have no user-defined destructor, pointer references are set to a non-valid address after a call to **`delete`**. This helps to prevent the reuse of stale pointer references.
42+
- Does limited pointer sanitization. In expressions that don't involve dereferences and in types that have no user-defined destructor, pointer references are set to a non-valid address after a call to **`delete`**. This sanitization helps to prevent the reuse of stale pointer references.
4243

43-
- Performs class member pointer initialization. Automatically initializes class members of pointer type to **`nullptr`** on object instantiation (before the constructor runs). This helps prevent the use of uninitialized pointers that the constructor does not explicitly initialize. The compiler-generated member pointer initialization is called as long as:
44+
- Initializes class member pointers. Automatically initializes class members of pointer type to **`nullptr`** on object instantiation (before the constructor runs). It helps prevent the use of uninitialized pointers that the constructor doesn't explicitly initialize. The compiler-generated member pointer initialization is called as long as:
4445

45-
- The object is not allocated using a custom (user defined) `operator new`
46+
- The object isn't allocated using a custom (user defined) `operator new`
4647

47-
- The object is not allocated as part of an array (for example `new A[x]`)
48+
- The object isn't allocated as part of an array (for example `new A[x]`)
4849

49-
- The class is not managed or imported
50+
- The class isn't managed or imported
5051

5152
- The class has a user-defined default constructor.
5253

5354
To be initialized by the compiler-generated class initialization function, a member must be a pointer, and not a property or constant.
5455

55-
## Remarks
56-
57-
For more information, see [Warnings, /sdl, and improving uninitialized variable detection](https://cloudblogs.microsoft.com/microsoftsecure/2012/06/06/warnings-sdl-and-improving-uninitialized-variable-detection/).
56+
For more information, see [Warnings, /sdl, and improving uninitialized variable detection](https://www.microsoft.com/security/blog/2012/06/06/warnings-sdl-and-improving-uninitialized-variable-detection/).
5857

59-
#### To set this compiler option in the Visual Studio development environment
58+
### To set this compiler option in the Visual Studio development environment
6059

6160
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
6261

63-
1. Select the **C/C++** folder.
62+
1. Select the **Configuration Properties** > **C/C++** > **General** property page.
6463

65-
1. On the **General** page, select the option from the **SDL checks** drop-down list.
64+
1. Set the **SDL checks** property by using the property drop-down control. Choose **OK** or **Apply** to save your changes.
6665

6766
## See also
6867

docs/c-language/c-enumeration-declarations.md

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,65 @@
11
---
2-
title: "C Enumeration Declarations"
3-
ms.date: "11/04/2016"
2+
title: "C enumeration declarations"
3+
description: "Enumeration declarations in the C programming language."
4+
ms.date: 10/02/2020
45
helpviewer_keywords: ["declarations, enumerations", "define directive (#define), alternative to", "enumerators, declaring", "#define directive, alternative to", "named constants, enumeration declarations", "declaring enumerations"]
56
ms.assetid: bd18f673-4dda-4bc1-92fd-d1ce10074910
67
---
7-
# C Enumeration Declarations
8+
# C enumeration declarations
89

9-
An enumeration consists of a set of named integer constants. An enumeration type declaration gives the name of the (optional) enumeration tag and defines the set of named integer identifiers (called the "enumeration set," "enumerator constants," "enumerators," or "members"). A variable with enumeration type stores one of the values of the enumeration set defined by that type.
10+
An enumeration consists of a set of named integer constants. An enumeration type declaration gives the name of the (optional) enumeration tag. And, it defines the set of named integer identifiers (called the *enumeration set*, *enumerator constants*, *enumerators*, or *members*). A variable of the enumeration type stores one of the values of the enumeration set defined by that type.
1011

1112
Variables of **`enum`** type can be used in indexing expressions and as operands of all arithmetic and relational operators. Enumerations provide an alternative to the `#define` preprocessor directive with the advantages that the values can be generated for you and obey normal scoping rules.
1213

13-
In ANSI C, the expressions that define the value of an enumerator constant always have **`int`** type; thus, the storage associated with an enumeration variable is the storage required for a single **`int`** value. An enumeration constant or a value of enumerated type can be used anywhere the C language permits an integer expression.
14+
In ANSI C, the expressions that define the value of an enumerator constant always have **`int`** type. That means the storage associated with an enumeration variable is the storage required for a single **`int`** value. An enumeration constant or a value of enumerated type can be used anywhere the C language permits an integer expression.
1415

1516
## Syntax
1617

17-
*enum-specifier*:<br/>
18-
&nbsp;&nbsp;&nbsp;&nbsp;**`enum`** *identifier*<sub>opt</sub> **{** *enumerator-list* **}**<br/>
19-
&nbsp;&nbsp;&nbsp;&nbsp;**`enum`** *identifier*
18+
*`enum-specifier`*:\
19+
&emsp;**`enum`** *`identifier`*<sub>opt</sub> **`{`** *`enumerator-list`* **`}`**\
20+
&emsp;**`enum`** *`identifier`*
2021

21-
The optional *identifier* names the enumeration type defined by *enumerator-list*. This identifier is often called the "tag" of the enumeration specified by the list. A type specifier of the form
22+
*`enumerator-list`*:\
23+
&emsp;*`enumerator`*\
24+
&emsp;*`enumerator-list`* **`,`** *`enumerator`*
2225

23-
```
26+
*`enumerator`*:\
27+
&emsp;*`enumeration-constant`*\
28+
&emsp;*`enumeration-constant`* **`=`** *`constant-expression`*
29+
30+
*`enumeration-constant`*:\
31+
&emsp;*`identifier`*
32+
33+
The optional *`identifier`* names the enumeration type defined by *`enumerator-list`*. This identifier is often called the "tag" of the enumeration specified by the list. A type specifier declares `identifier` to be the tag of the enumeration specified by the *`enumerator-list`* nonterminal, as seen here:
34+
35+
```C
2436
enum identifier
2537
{
26-
enumerator-list
38+
// enumerator-list
2739
}
2840
```
2941

30-
declares *identifier* to be the tag of the enumeration specified by the *enumerator-list* nonterminal. The *enumerator-list* defines the "enumerator content." The *enumerator-list* is described in detail below.
31-
32-
If the declaration of a tag is visible, subsequent declarations that use the tag but omit *enumerator-list* specify the previously declared enumerated type. The tag must refer to a defined enumeration type, and that enumeration type must be in current scope. Since the enumeration type is defined elsewhere, the *enumerator-list* does not appear in this declaration. Declarations of types derived from enumerations and **`typedef`** declarations for enumeration types can use the enumeration tag before the enumeration type is defined.
33-
34-
## Syntax
35-
36-
*enumerator-list*:<br/>
37-
&nbsp;&nbsp;&nbsp;&nbsp;*enumerator*<br/>
38-
&nbsp;&nbsp;&nbsp;&nbsp;*enumerator-list* **,** *enumerator*
39-
40-
*enumerator*:<br/>
41-
&nbsp;&nbsp;&nbsp;&nbsp;*enumeration-constant*<br/>
42-
&nbsp;&nbsp;&nbsp;&nbsp;*enumeration-constant* **=** *constant-expression*
42+
The *`enumerator-list`* defines the members of the enumeration set.
4343

44-
*enumeration-constant*:<br/>
45-
&nbsp;&nbsp;&nbsp;&nbsp;*identifier*
44+
If the declaration of a tag is visible, later declarations that use the tag but omit *`enumerator-list`* specify the previously declared enumerated type. The tag must refer to a defined enumeration type, and that enumeration type must be in current scope. Since the enumeration type is defined elsewhere, the *`enumerator-list`* doesn't appear in this declaration. Declarations of types derived from enumerations and **`typedef`** declarations for enumeration types can use the enumeration tag before the enumeration type is defined.
4645

47-
Each *enumeration-constant* in an *enumeration-list* names a value of the enumeration set. By default, the first *enumeration-constant* is associated with the value 0. The next *enumeration-constant* in the list is associated with the value of ( *constant-expression* + 1 ), unless you explicitly associate it with another value. The name of an *enumeration-constant* is equivalent to its value.
46+
Each *`enumeration-constant`* in an *`enumerator-list`* names a value of the enumeration set. By default, the first *`enumeration-constant`* is associated with the value 0. The next *`enumeration-constant`* in the list is associated with the value of ( *`constant-expression`* + 1 ), unless you explicitly associate it with another value. The name of an *`enumeration-constant`* is equivalent to its value.
4847

49-
You can use *enumeration-constant = constant-expression* to override the default sequence of values. Thus, if *enumeration-constant = constant-expression* appears in the *enumerator-list*, the *enumeration-constant* is associated with the value given by *constant-expression*. The *constant-expression* must have **`int`** type and can be negative.
48+
You can use *`enumeration-constant`* = *`constant-expression`* to override the default sequence of values. That is, if *`enumeration-constant`* = *`constant-expression`* appears in the *`enumerator-list`*, the *`enumeration-constant`* is associated with the value given by *`constant-expression`*. The *`constant-expression`* must have **`int`** type and can be negative.
5049

5150
The following rules apply to the members of an enumeration set:
5251

53-
- An enumeration set can contain duplicate constant values. For example, you could associate the value 0 with two different identifiers, perhaps named `null` and `zero`, in the same set.
52+
- An enumeration set can contain duplicate constant values. For example, you could associate the value 0 with two different identifiers, for example, members named `null` and `zero`, in the same set.
5453

55-
- The identifiers in the enumeration list must be distinct from other identifiers in the same scope with the same visibility, including ordinary variable names and identifiers in other enumeration lists.
54+
- The identifiers in the enumeration list must be distinct from other identifiers in the same scope with the same visibility. That includes ordinary variable names and identifiers in other enumeration lists.
5655

5756
- Enumeration tags obey the normal scoping rules. They must be distinct from other enumeration, structure, and union tags with the same visibility.
5857

5958
## Examples
6059

6160
These examples illustrate enumeration declarations:
6261

63-
```
62+
```C
6463
enum DAY /* Defines an enumeration type */
6564
{
6665
saturday, /* Names day and declares a */
@@ -77,21 +76,21 @@ The value 0 is associated with `saturday` by default. The identifier `sunday` is
7776

7877
In this example, a value from the set `DAY` is assigned to the variable `today`.
7978

80-
```
79+
```C
8180
enum DAY today = wednesday;
8281
```
8382

84-
Note that the name of the enumeration constant is used to assign the value. Since the `DAY` enumeration type was previously declared, only the enumeration tag `DAY` is necessary.
83+
The name of the enumeration constant is used to assign the value. Since the `DAY` enumeration type was previously declared, only the enumeration tag `DAY` is necessary.
8584

8685
To explicitly assign an integer value to a variable of an enumerated data type, use a type cast:
8786

88-
```
87+
```C
8988
workday = ( enum DAY ) ( day_value - 1 );
9089
```
9190

92-
This cast is recommended in C but is not required.
91+
This cast is recommended in C but isn't required.
9392

94-
```
93+
```C
9594
enum BOOLEAN /* Declares an enumeration data type called BOOLEAN */
9695
{
9796
false, /* false = 0, true = 1 */
@@ -103,20 +102,20 @@ enum BOOLEAN end_flag, match_flag; /* Two variables of type BOOLEAN */
103102

104103
This declaration can also be specified as
105104

106-
```
105+
```C
107106
enum BOOLEAN { false, true } end_flag, match_flag;\
108107
```
109108
110109
or as
111110
112-
```
111+
```C
113112
enum BOOLEAN { false, true } end_flag;
114113
enum BOOLEAN match_flag;
115114
```
116115

117116
An example that uses these variables might look like this:
118117

119-
```
118+
```C
120119
if ( match_flag == false )
121120
{
122121
.
@@ -128,7 +127,7 @@ if ( match_flag == false )
128127
129128
Unnamed enumerator data types can also be declared. The name of the data type is omitted, but variables can be declared. The variable `response` is a variable of the type defined:
130129
131-
```
130+
```C
132131
enum { yes, no } response;
133132
```
134133

docs/c-runtime-library/internationalization.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ms.assetid: ee536a04-3558-4729-8e10-6dabcde055fd
1010
# Internationalization
1111

1212
The Microsoft runtime library provides many routines that you can use to customize your app for international markets such as:
13+
1314
- [locale-related routines](../c-runtime-library/locale.md)
1415
- wide-character routines
1516
- multibyte-character routines

0 commit comments

Comments
 (0)