Skip to content

Commit 20d59c2

Browse files
authored
Merge pull request #5860 from MicrosoftDocs/main
4/1/2025 AM Publish
2 parents a287aab + 1aacbef commit 20d59c2

14 files changed

+170
-170
lines changed

docs/build/working-with-project-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You can view and modify these properties by using *property pages*. To access th
1515

1616
When you create a project, the system assigns values for various properties. The defaults vary somewhat depending on the kind of project and what options you choose in the app wizard. For example, an Active Template Library (ATL) project has properties related to Microsoft Interface Definition Language (MIDL) files, but these properties are absent in a basic console application. The default properties are shown in the Advanced pane in the **Property Pages** window:
1717

18-
:::image type="content" source="media/visual-c---project-defaults.png" alt-text="Screenshot of the Visual Studio project properties dialog box with the Advanced pane selected." lightbox="media/visual-c---project-defaults.png":::
18+
:::image type="content" source="media/visual-c---project-defaults.png" alt-text="Screenshot of the Visual Studio project properties dialog box with the Advanced pane selected. Properties such as Use of MFC, Character Set, and so on are highlighted." lightbox="media/visual-c---project-defaults.png":::
1919

2020
## Apply properties to build configurations and target platforms
2121

docs/build/x64-software-conventions.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: x64 ABI conventions"
33
title: "x64 ABI conventions"
4-
ms.date: 04/21/2022
4+
ms.date: 03/28/2025
55
helpviewer_keywords: ["x64 coding conventions", "x64 abi", "Visual C++, x64 calling conventions"]
66
---
77
# Overview of x64 ABI conventions
@@ -11,10 +11,11 @@ This topic describes the basic application binary interface (ABI) for x64, the 6
1111
## x64 calling conventions
1212

1313
Two important differences between x86 and x64 are:
14+
1415
- 64-bit addressing capability
1516
- Sixteen 64-bit registers for general use.
1617

17-
Given the expanded register set, x64 uses the [__fastcall](../cpp/fastcall.md) calling convention and a RISC-based exception-handling model.
18+
Given the expanded register set, x64 uses the [`__fastcall`](../cpp/fastcall.md) calling convention and a RISC-based exception-handling model.
1819

1920
The **`__fastcall`** convention uses registers for the first four arguments, and the stack frame to pass more arguments. For details on the x64 calling convention, including register usage, stack parameters, return values, and stack unwinding, see [x64 calling convention](x64-calling-convention.md).
2021

@@ -116,7 +117,7 @@ _declspec(align(2)) struct {
116117
}
117118
```
118119
119-
![Diagram showing the example 1 structure layout.](../build/media/vcamd_conv_ex_1_block.png "AMD conversion example 1 structure layout")
120+
:::image type="content" source="../build/media/vcamd_conv_ex_1_block.png" alt-text="Diagram showing the structure layout for example 1. The diagram shows 2 bytes of memory. Member a, a short, occupies bytes 0 through 1.":::
120121
121122
#### Example 2
122123
@@ -130,7 +131,9 @@ _declspec(align(8)) struct {
130131
}
131132
```
132133

133-
![Diagram showing the example 2 structure layout.](../build/media/vcamd_conv_ex_2_block.png "AMD conversion example 2 structure layout")
134+
:::image type="complex" source="../build/media/vcamd_conv_ex_2_block.png" alt-text="Diagram showing the structure layout for example 2.":::
135+
The diagram shows 24 bytes of memory. Member a, an int, occupies bytes 0 through 3. The diagram shows padding for bytes 4 through 7. Member b, a double, occupies bytes 8 through 15. Member c, a short, occupies bytes 16 through 17. Bytes 18 through 23 are unused.
136+
:::image-end:::
134137

135138
#### Example 3
136139

@@ -145,7 +148,9 @@ _declspec(align(4)) struct {
145148
}
146149
```
147150
148-
![Diagram showing the example 3 structure layout.](../build/media/vcamd_conv_ex_3_block.png "AMD conversion example 3 structure layout")
151+
:::image type="complex" source="../build/media/vcamd_conv_ex_3_block.png" alt-text="Diagram showing the structure layout for example 3.":::
152+
The diagram shows 12 bytes of memory. Member a, a char, occupies byte 0. Byte 1 is padding. Member b, a short, occupies bytes 2 through 4. Member c, a char, occupies byte 4. Bytes 5 through 7 are padding. Member d, an int, occupies bytes 8 through 11.
153+
:::image-end:::
149154
150155
#### Example 4
151156
@@ -159,7 +164,9 @@ _declspec(align(8)) union {
159164
}
160165
```
161166

162-
![Diagram showing the example 4 union layout.](../build/media/vcamd_conv_ex_4_block.png "AMD conversion example 4 union layout")
167+
:::image type="complex" source="../build/media/vcamd_conv_ex_4_block.png" alt-text="Diagram showing the union layout for example 4.":::
168+
The diagram shows 8 bytes of memory. Member p, a char, occupies byte 0. Member s, a short, occupies bytes 0 through 1. Member l, a long, occupies bytes 0 through 3. Bytes 4 through 7 are padding.
169+
:::image-end:::
163170

164171
### Bitfields
165172

@@ -211,7 +218,7 @@ On function exit and on function entry to C Runtime Library calls and Windows sy
211218

212219
## Stack usage
213220

214-
For details on stack allocation, alignment, function types and stack frames on x64, see [x64 stack usage](stack-usage.md).
221+
For details on stack allocation, alignment, function types, and stack frames on x64, see [x64 stack usage](stack-usage.md).
215222

216223
## Prolog and epilog
217224

docs/code-quality/c6296.md

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,35 @@
11
---
2-
description: "Learn more about: Warning C6296"
32
title: Warning C6296
4-
ms.date: 11/04/2016
3+
description: "Learn more about: Warning C6296"
4+
ms.date: 03/30/2025
55
f1_keywords: ["C6296", "LOOP_ONLY_EXECUTED_ONCE", "__WARNING_LOOP_ONLY_EXECUTED_ONCE"]
66
helpviewer_keywords: ["C6296"]
7-
ms.assetid: 226573e0-db18-4c44-8fc6-0bc09d1028bc
87
---
98
# Warning C6296
109

11-
> Ill-defined for-loop: Loop body only executed once
10+
> Ill-defined for-loop. Loop body only executed once.
1211
1312
## Remarks
1413

15-
This warning indicates that a for-loop might not function as intended. When the index is unsigned and a loop counts down from zero, its body is run only once.
14+
This warning indicates that a for-loop might unintentionally execute only once. A loop with an unsigned index counting down from zero or a mistaken use of `==` might cause this warning.
1615

1716
Code analysis name: `LOOP_ONLY_EXECUTED_ONCE`
1817

1918
## Example
2019

21-
The following code generates this warning:
20+
The following example generates C6296. Each for-loop shown executes exactly once.
2221

2322
```cpp
24-
void f( )
23+
int main()
2524
{
26-
unsigned int i;
25+
for (unsigned int i = 0; i < 10; i--) {} // C6296
26+
// Use the following line to resolve the warning:
27+
// for (unsigned int i = 0; i < 10; i++) {}
2728

28-
for (i = 0; i < 100; i--)
29-
{
30-
// code ...
31-
}
32-
}
33-
```
29+
for (int i = 0; i == 0; i++) {} // C6296
3430

35-
To correct this warning, use the following code:
36-
37-
```cpp
38-
void f( )
39-
{
40-
unsigned int i;
31+
for (int i = 0; i < 1; i++) {} // OK
4132

42-
for (i = 0; i < 100; i++)
43-
{
44-
// code ...
45-
}
33+
for (int i = 1; i > 0; i--) {} // OK
4634
}
4735
```

docs/code-quality/quick-start-code-analysis-for-c-cpp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ You can improve the quality of your application by running code analysis regular
1919

2020
1. To run code analysis every time the project is built using the selected configuration, select the **Enable Code Analysis on Build** check box. You can also run code analysis manually by opening the **Analyze** menu and then choosing **Run Code Analysis on** *ProjectName* or **Run Code Analysis on File**.
2121

22-
1. Choose the [rule set](using-rule-sets-to-specify-the-cpp-rules-to-run.md) that you want to use or create a [custom rule set](using-rule-sets-to-specify-the-cpp-rules-to-run.md#to-create-a-rule-set-in-a-text-editor). If using LLVM/clang-cl, see [Using Clang-Tidy in Visual Studio](../code-quality/clang-tidy.md) to configure Clang-Tidy analysis options.
22+
1. Choose the [rule set](using-rule-sets-to-specify-the-cpp-rules-to-run.md) that you want to use or create a [custom rule set](using-rule-sets-to-specify-the-cpp-rules-to-run.md#to-create-a-rule-set-in-a-text-editor). If using LLVM/clang-cl, see [Using Clang-Tidy in Visual Studio](clang-tidy.md) to configure Clang-Tidy analysis options.
2323

2424
### Standard C/C++ rule sets
2525

@@ -100,7 +100,7 @@ The Error List window lists the code analysis warnings found. The results are di
100100

101101
For detailed information about the warning, including possible solutions to the issue, choose the warning ID in the Code column to display its corresponding online help article.
102102

103-
Double-click a warning to move the cursor to the line of code that caused the warning in the Visual Studio code editor. Or, press Enter on the selected warning.
103+
Double-click a warning to move the cursor to the line of code that caused the warning in the code editor. Or, press Enter on the selected warning.
104104

105105
After you understand the problem, you can resolve it in your code. Then, rerun code analysis to make sure that the warning no longer appears in the Error List.
106106

@@ -128,4 +128,4 @@ You can search long lists of warning messages and you can filter warnings in mul
128128

129129
## See also
130130

131-
- [Code analysis for C/C++](../code-quality/code-analysis-for-c-cpp-overview.md)
131+
- [Code analysis for C/C++](code-analysis-for-c-cpp-overview.md)

docs/code-quality/understanding-sal.md

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
2-
description: "Learn more about: Understanding SAL"
32
title: Understanding SAL
3+
description: "Learn more about: Understanding SAL"
44
ms.date: 11/04/2016
55
ms.topic: "conceptual"
6-
ms.assetid: a94d6907-55f2-4874-9571-51d52d6edcfd
76
---
87
# Understanding SAL
98

@@ -94,9 +93,9 @@ These annotations help identify possible uninitialized values and invalid null p
9493
9594
This section shows code examples for the basic SAL annotations.
9695
97-
### Using the Visual Studio Code Analysis Tool to Find Defects
96+
### Using the Visual Studio code analysis tool to find defects
9897
99-
In the examples, the Visual Studio Code Analysis tool is used together with SAL annotations to find code defects. Here's how to do that.
98+
In the examples, the Visual Studio code analysis tool is used together with SAL annotations to find code defects. Here's how to do that.
10099
101100
#### To use Visual Studio code analysis tools and SAL
102101
@@ -145,7 +144,7 @@ void BadInCaller()
145144
}
146145
```
147146

148-
If you use Visual Studio Code Analysis on this example, it validates that the callers pass a non-Null pointer to an initialized buffer for `pInt`. In this case, `pInt` pointer cannot be NULL.
147+
If you use Visual Studio code analysis on this example, it validates that the callers pass a non-Null pointer to an initialized buffer for `pInt`. In this case, `pInt` pointer cannot be NULL.
149148

150149
### Example: The \_In\_opt\_ Annotation
151150

@@ -172,7 +171,7 @@ void InOptCaller()
172171
}
173172
```
174173
175-
Visual Studio Code Analysis validates that the function checks for NULL before it accesses the buffer.
174+
Visual Studio code analysis validates that the function checks for NULL before it accesses the buffer.
176175
177176
### Example: The \_Out\_ Annotation
178177
@@ -198,7 +197,7 @@ void OutCaller()
198197
}
199198
```
200199

201-
Visual Studio Code Analysis Tool validates that the caller passes a non-NULL pointer to a buffer for `pInt` and that the buffer is initialized by the function before it returns.
200+
Visual Studio code analysis validates that the caller passes a non-NULL pointer to a buffer for `pInt` and that the buffer is initialized by the function before it returns.
202201

203202
### Example: The \_Out\_opt\_ Annotation
204203

@@ -225,7 +224,7 @@ void OutOptCaller()
225224
}
226225
```
227226
228-
Visual Studio Code Analysis validates that this function checks for NULL before `pInt` is dereferenced, and if `pInt` is not NULL, that the buffer is initialized by the function before it returns.
227+
Visual Studio code analysis validates that this function checks for NULL before `pInt` is dereferenced, and if `pInt` is not NULL, that the buffer is initialized by the function before it returns.
229228
230229
### Example: The \_Inout\_ Annotation
231230
@@ -256,7 +255,7 @@ void BadInOutCaller()
256255
}
257256
```
258257

259-
Visual Studio Code Analysis validates that callers pass a non-NULL pointer to an initialized buffer for `pInt`, and that, before return, `pInt` is still non-NULL and the buffer is initialized.
258+
Visual Studio code analysis validates that callers pass a non-NULL pointer to an initialized buffer for `pInt`, and that, before return, `pInt` is still non-NULL and the buffer is initialized.
260259

261260
### Example: The \_Inout\_opt\_ Annotation
262261

@@ -285,7 +284,7 @@ void InOutOptCaller()
285284
}
286285
```
287286
288-
Visual Studio Code Analysis validates that this function checks for NULL before it accesses the buffer, and if `pInt` is not NULL, that the buffer is initialized by the function before it returns.
287+
Visual Studio code analysis validates that this function checks for NULL before it accesses the buffer, and if `pInt` is not NULL, that the buffer is initialized by the function before it returns.
289288
290289
### Example: The \_Outptr\_ Annotation
291290
@@ -315,7 +314,7 @@ void OutPtrCaller()
315314
}
316315
```
317316

318-
Visual Studio Code Analysis validates that the caller passes a non-NULL pointer for `*pInt`, and that the buffer is initialized by the function before it returns.
317+
Visual Studio code analysis validates that the caller passes a non-NULL pointer for `*pInt`, and that the buffer is initialized by the function before it returns.
319318

320319
### Example: The \_Outptr\_opt\_ Annotation
321320

@@ -347,7 +346,7 @@ void OutPtrOptCaller()
347346
}
348347
```
349348
350-
Visual Studio Code Analysis validates that this function checks for NULL before `*pInt` is dereferenced, and that the buffer is initialized by the function before it returns.
349+
Visual Studio code analysis validates that this function checks for NULL before `*pInt` is dereferenced, and that the buffer is initialized by the function before it returns.
351350
352351
### Example: The \_Success\_ Annotation in Combination with \_Out\_
353352
@@ -366,7 +365,7 @@ bool GetValue(_Out_ int *pInt, bool flag)
366365
}
367366
```
368367

369-
The `_Out_` annotation causes Visual Studio Code Analysis to validate that the caller passes a non-NULL pointer to a buffer for `pInt`, and that the buffer is initialized by the function before it returns.
368+
The `_Out_` annotation causes Visual Studio code analysis to validate that the caller passes a non-NULL pointer to a buffer for `pInt`, and that the buffer is initialized by the function before it returns.
370369

371370
## SAL Best Practice
372371

@@ -384,18 +383,18 @@ Here are some guidelines:
384383

385384
- Annotate value-range annotations so that Code Analysis can ensure buffer and pointer safety.
386385

387-
- Annotate locking rules and locking side effects. For more information, see [Annotating Locking Behavior](../code-quality/annotating-locking-behavior.md).
386+
- Annotate locking rules and locking side effects. For more information, see [Annotating Locking Behavior](annotating-locking-behavior.md).
388387

389388
- Annotate driver properties and other domain-specific properties.
390389

391390
Or you can annotate all parameters to make your intent clear throughout and to make it easy to check that annotations have been done.
392391

393392
## See also
394393

395-
- [Using SAL Annotations to Reduce C/C++ Code Defects](../code-quality/using-sal-annotations-to-reduce-c-cpp-code-defects.md)
396-
- [Annotating Function Parameters and Return Values](../code-quality/annotating-function-parameters-and-return-values.md)
397-
- [Annotating Function Behavior](../code-quality/annotating-function-behavior.md)
398-
- [Annotating Structs and Classes](../code-quality/annotating-structs-and-classes.md)
399-
- [Annotating Locking Behavior](../code-quality/annotating-locking-behavior.md)
400-
- [Specifying When and Where an Annotation Applies](../code-quality/specifying-when-and-where-an-annotation-applies.md)
401-
- [Best Practices and Examples](../code-quality/best-practices-and-examples-sal.md)
394+
- [Using SAL Annotations to Reduce C/C++ Code Defects](using-sal-annotations-to-reduce-c-cpp-code-defects.md)
395+
- [Annotating Function Parameters and Return Values](annotating-function-parameters-and-return-values.md)
396+
- [Annotating Function Behavior](annotating-function-behavior.md)
397+
- [Annotating Structs and Classes](annotating-structs-and-classes.md)
398+
- [Annotating Locking Behavior](annotating-locking-behavior.md)
399+
- [Specifying When and Where an Annotation Applies](specifying-when-and-where-an-annotation-applies.md)
400+
- [Best Practices and Examples](best-practices-and-examples-sal.md)

docs/code-quality/using-the-cpp-core-guidelines-checkers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,11 @@ Because of the way the code analysis rules get loaded within Visual Studio 2015,
317317

318318
1. In the **NuGet Package Manager** window, search for Microsoft.CppCoreCheck.
319319

320-
![Nuget Package Manager window showing the CppCoreCheck package.](../code-quality/media/cppcorecheck_nuget_window.png)
320+
![Nuget Package Manager window showing the CppCoreCheck package.](media/cppcorecheck_nuget_window.png)
321321

322322
1. Select the Microsoft.CppCoreCheck package and then choose the **Install** button to add the rules to your project.
323323

324-
The NuGet package adds an MSBuild *`.targets`* file to your project that is invoked when you enable code analysis on your project. The *`.targets`* file adds the C++ Core Check rules as another extension to the Visual Studio Code analysis tool. When the package is installed, you can use the Property Pages dialog to enable or disable the released and experimental rules.
324+
The NuGet package adds an MSBuild *`.targets`* file to your project that is invoked when you enable code analysis on your project. The *`.targets`* file adds the C++ Core Check rules as another extension to the Visual Studio code analysis tool. When the package is installed, you can use the Property Pages dialog to enable or disable the released and experimental rules.
325325

326326
::: moniker-end
327327

docs/dotnet/how-to-declare-override-specifiers-in-native-compilations-cpp-cli.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
2-
description: "Learn more about: How to: Declare Override Specifiers in Native Compilations (C++/CLI)"
32
title: "How to: Declare Override Specifiers (C++/CLI)"
3+
description: "Learn more about: How to: Declare Override Specifiers in Native Compilations (C++/CLI)"
44
ms.date: "11/04/2016"
55
helpviewer_keywords: ["override specifiers in native compilation, overriding"]
6-
ms.assetid: d0551836-9ac7-41eb-a6e9-a4b3ef60767d
76
---
87
# How to: Declare Override Specifiers in Native Compilations (C++/CLI)
98

10-
[sealed](../extensions/sealed-cpp-component-extensions.md), [abstract](../extensions/abstract-cpp-component-extensions.md), and [override](../extensions/override-cpp-component-extensions.md) are available in compilations that do not use **/ZW** or [/clr](../build/reference/clr-common-language-runtime-compilation.md).
9+
[`sealed`](../extensions/sealed-cpp-component-extensions.md), [`abstract`](../extensions/abstract-cpp-component-extensions.md), and [`override`](../extensions/override-cpp-component-extensions.md) are available in compilations that do not use **/ZW** or [`/clr`](../build/reference/clr-common-language-runtime-compilation.md).
1110

1211
> [!NOTE]
13-
> The ISO C++11 Standard language has the [override](../cpp/override-specifier.md) identifier and the [final](../cpp/final-specifier.md) identifier, and both are supported in Visual Studio Use `final` instead of **`sealed`** in code that is meant to be compiled as native-only.
12+
> The ISO C++11 Standard language [`override`](../cpp/override-specifier.md) and [`final`](../cpp/final-specifier.md) specifiers are supported in Visual Studio. Use `final` instead of **`sealed`** in code that is meant to be compiled as native-only.
1413
1514
## Example: sealed is valid
1615

@@ -67,7 +66,7 @@ public:
6766

6867
### Description
6968

70-
This example shows that **`abstract`** is valid in native compilations.
69+
This example shows that `abstract` is valid in native compilations.
7170

7271
### Code
7372

docs/embedded/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
items:
2-
- name: Embedded development with Visual Studio and Visual Studio code
2+
- name: Embedded development with Visual Studio and Visual Studio Code
33
href: ./index.yml
44
- name: Download and install the Embedded Tools
55
href: download-and-install-the-embedded-tooling.md
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
---
2-
description: "Learn more about: Compiler Error C2162"
32
title: "Compiler Error C2162"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Error C2162"
4+
ms.date: "03/30/2025"
55
f1_keywords: ["C2162"]
66
helpviewer_keywords: ["C2162"]
7-
ms.assetid: 34923628-d35e-48ab-9072-b95e3b5f6b45
87
---
98
# Compiler Error C2162
109

11-
expected macro formal parameter
10+
> expected macro formal parameter
1211
13-
The token following a stringizing operator (#) is not a formal parameter name.
12+
The token following a [stringizing operator (#)](../../preprocessor/stringizing-operator-hash.md) or a [charizing operator (#@)](../../preprocessor/charizing-operator-hash-at.md) is not a formal parameter.
1413

1514
## Example
1615

17-
The following sample generates C2162:
16+
The following example generates C2162:
1817

1918
```cpp
2019
// C2162.cpp
2120
// compile with: /c
22-
#include <stdio.h>
23-
24-
#define print(a) printf_s(b) // OK
25-
#define print(a) printf_s(#b) // C2162
21+
#define make_string1(s) # // C2162
22+
#define make_string2(s) #s // OK
2623
```

0 commit comments

Comments
 (0)