Skip to content

Commit 1ff839f

Browse files
Learn Build Service GitHub AppLearn Build Service GitHub App
authored andcommitted
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs-pr (branch live)
2 parents 6b02bb1 + 4adeb98 commit 1ff839f

File tree

6 files changed

+59
-58
lines changed

6 files changed

+59
-58
lines changed

docs/assembler/masm/masm-for-x64-ml64-exe.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ description: "Learn more about: Microsoft Macro Assembler (MASM) for x64 (ml64.e
33
title: "MASM for x64 (ml64.exe)"
44
ms.date: 09/21/2021
55
helpviewer_keywords: ["ml64", "ml64.exe", "masm for x64"]
6-
ms.assetid: 89059103-f372-4968-80ea-0c7f90bb9c91
76
---
87
# MASM for x64 (ml64.exe)
98

10-
Visual Studio includes both 32-bit and 64-bit hosted versions of MASM (the Microsoft Macro Assembler) to target x64 code. Named ml64.exe, it's the assembler that accepts x64 assembler language. The MASM command-line tools are installed when you choose a C++ workload during Visual Studio installation. The MASM tools aren't available as a separate download. For instructions on how to download and install a copy of Visual Studio, see [Install Visual Studio](/visualstudio/install/install-visual-studio). If you only want the command-line tools, not the full IDE, download the [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022).
9+
Visual Studio includes both 32-bit and 64-bit hosted versions of MASM (the Microsoft Macro Assembler) to target x64 code. Named ml64.exe, it's the assembler that accepts x64 assembly language. The MASM command-line tools are installed when you choose a C++ workload during Visual Studio installation. The MASM tools aren't available as a separate download. For instructions on how to download and install a copy of Visual Studio, see [Install Visual Studio](/visualstudio/install/install-visual-studio). If you only want the command-line tools, not the full IDE, download the [Build Tools for Visual Studio](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022).
1110

1211
To use ml64.exe on the command line, start a developer command prompt for x64 targets. A developer command prompt sets the required path and other environment variables. For information on how to start a developer command prompt, see [Build C/C++ code on the command line](../../build/building-on-the-command-line.md).
1312

docs/build/reference/running-nmake.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ helpviewer_keywords: ["targets, building", "response files, NMAKE", "targets", "
1212
1313
## Remarks
1414

15+
NMAKE must run in a Developer Command Prompt window. A Developer Command Prompt window has the environment variables set for the tools, libraries, and include file paths required to build at the command line. For details on how to open a Developer Command Prompt window, see [Use the MSVC toolset from the command line](../building-on-the-command-line.md).
16+
1517
NMAKE builds only specified *targets* or, when none is specified, the first target in the makefile. The first makefile target can be a [pseudotarget](description-blocks.md#pseudotargets) that builds other targets. NMAKE uses makefiles specified with **`/F`**, or if **`/F`** isn't specified, the Makefile file in the current directory. If no makefile is specified, it uses inference rules to build command-line *targets*.
1618

1719
The *command-file* text file (or response file) contains command-line input. Other input can precede or follow \@*command-file*. A path is permitted. In *command-file*, line breaks are treated as spaces. Enclose macro definitions in quotation marks if they contain spaces.

docs/code-quality/c6386.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
description: "Learn more about: Warning C6386"
33
title: Warning C6386
4-
ms.date: 11/04/2016
4+
ms.date: 4/30/2025
55
f1_keywords: ["C6386", "WRITE_OVERRUN", "__WARNING_WRITE_OVERRUN"]
66
helpviewer_keywords: ["C6386"]
7-
ms.assetid: 84e69fe8-8f03-4bb3-b194-e5551882e214
87
---
98
# Warning C6386
109

@@ -23,24 +22,22 @@ The following code generates both this warning and [C6201](../code-quality/c6201
2322
```cpp
2423
#define MAX 25
2524

26-
void f ( )
25+
void f()
2726
{
28-
char ar[MAX];
29-
// code ...
30-
ar[MAX] = '\0';
27+
char a[MAX];
28+
a[MAX] = '\0'; // this writes one element past the end of the buffer
3129
}
3230
```
3331

34-
To correct both warnings, use the following code:
32+
To correct the warning, use the following code which accounts for the fact that array indexes are zero-based. Thus `MAX - 1` is the last element in the buffer:
3533

3634
```cpp
3735
#define MAX 25
3836

3937
void f ( )
4038
{
4139
char a[MAX];
42-
// code ...
43-
a[MAX - 1] = '\0';
40+
a[MAX-1] = '\0';
4441
}
4542
```
4643
Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,113 @@
11
---
22
description: "Learn more about: Functions with Variable Argument Lists (C++)"
33
title: "Functions with Variable Argument Lists (C++)"
4-
ms.date: "11/04/2016"
4+
ms.date: 05/01/2025
55
helpviewer_keywords: ["arguments [C++], variable number of", "variable argument lists", "declarators, functions", "argument lists [C++], variable number of", "declaring functions [C++], variables", "function calls, variable number of arguments"]
6-
ms.assetid: 27c2f83a-21dd-44c6-913c-2834cb944703
76
---
87
# Functions with Variable Argument Lists (C++)
98

10-
Function declarations in which the last member of is the ellipsis (...) can take a variable number of arguments. In these cases, C++ provides type checking only for the explicitly declared arguments. You can use variable argument lists when you need to make a function so general that even the number and types of arguments can vary. The family of functions is an example of functions that use variable argument lists.`printf`*argument-declaration-list*
9+
Function declarations that have ellipsis (...) as the last argument take a variable number of arguments. C++ provides type checking only for the explicitly declared arguments. You can use variable argument lists when the number and types of arguments to the function can vary. The `printf` family of functions is an example of functions that have variable argument lists.
1110

1211
## Functions with variable arguments
1312

14-
To access arguments after those declared, use the macros contained in the standard include file \<stdarg.h> as described below.
13+
To access arguments after those declared, use the macros contained in the standard include file `<stdarg.h>` as explained in this article.
1514

1615
**Microsoft Specific**
1716

18-
Microsoft C++ allows the ellipsis to be specified as an argument if the ellipsis is the last argument and the ellipsis is preceded by a comma. Therefore, the declaration `int Func( int i, ... );` is legal, but `int Func( int i ... );` is not.
17+
Microsoft C++ allows the ellipsis to be specified as an argument if the ellipsis is the last argument and a comma comes before the ellipsis. Therefore, the declaration `int Func( int i, ... );` is legal, but `int Func( int i ... );` isn't.
1918

2019
**END Microsoft Specific**
2120

22-
Declaration of a function that takes a variable number of arguments requires at least one placeholder argument, even if it is not used. If this placeholder argument is not supplied, there is no way to access the remaining arguments.
21+
Declaration of a function that takes a variable number of arguments requires at least one placeholder argument, even if it isn't used. If this placeholder argument isn't supplied, there's no way to access the remaining arguments.
2322

24-
When arguments of type **`char`** are passed as variable arguments, they are converted to type **`int`**. Similarly, when arguments of type **`float`** are passed as variable arguments, they are converted to type **`double`**. Arguments of other types are subject to the usual integral and floating-point promotions. See [Standard Conversions](standard-conversions.md) for more information.
23+
When arguments of type **`char`** are passed as variable arguments, they're converted to type **`int`**. Similarly, when arguments of type **`float`** are passed as variable arguments, they're converted to type **`double`**. Arguments of other types are subject to the usual integral and floating-point promotions. For more information, see [Standard Conversions](standard-conversions.md).
2524

26-
Functions that require variable lists are declared by using the ellipsis (...) in the argument list. Use the types and macros that are described in the \<stdarg.h> include file to access arguments that are passed by a variable list. For more information about these macros, see [va_arg, va_copy, va_end, va_start](../c-runtime-library/reference/va-arg-va-copy-va-end-va-start.md). in the documentation for the C Run-Time Library.
25+
Functions that require variable lists are declared by using the ellipsis (...) in the argument list. Use the types and macros that are described in the `<stdarg.h>` include file to access arguments that are passed by a variable list. For more information about these macros, see [va_arg, va_copy, va_end, va_start](../c-runtime-library/reference/va-arg-va-copy-va-end-va-start.md).
2726

28-
The following example shows how the macros work together with the type (declared in \<stdarg.h>):
27+
The following example shows how to use the macros to process a variable argument list:
2928

3029
```cpp
3130
// variable_argument_lists.cpp
31+
3232
#include <stdio.h>
3333
#include <stdarg.h>
3434

3535
// Declaration, but not definition, of ShowVar.
3636
void ShowVar( char *szTypes, ... );
37+
3738
int main() {
3839
ShowVar( "fcsi", 32.4f, 'a', "Test string", 4 );
3940
}
4041

41-
// ShowVar takes a format string of the form
42-
// "ifcs", where each character specifies the
43-
// type of the argument in that position.
42+
// ShowVar takes a format string of the form
43+
// "ifcs", where each character specifies the
44+
// type of the argument in that position.
4445
//
45-
// i = int
46-
// f = float
47-
// c = char
48-
// s = string (char *)
46+
// i = int
47+
// f = float
48+
// c = char
49+
// s = string (char *)
4950
//
50-
// Following the format specification is a variable
51-
// list of arguments. Each argument corresponds to
52-
// a format character in the format string to which
51+
// Following the format specification is a variable
52+
// list of arguments. Each argument corresponds to
53+
// a format character in the format string to which
5354
// the szTypes parameter points
5455
void ShowVar( char *szTypes, ... ) {
5556
va_list vl;
5657
int i;
5758

58-
// szTypes is the last argument specified; you must access
59-
// all others using the variable-argument macros.
59+
// szTypes is the last argument specified; you must access
60+
// all others using the variable-argument macros.
6061
va_start( vl, szTypes );
6162

6263
// Step through the list.
6364
for( i = 0; szTypes[i] != '\0'; ++i ) {
65+
6466
union Printable_t {
6567
int i;
6668
float f;
6769
char c;
6870
char *s;
6971
} Printable;
7072

71-
switch( szTypes[i] ) { // Type to expect.
73+
switch( szTypes[i] ) { // Type to expect
7274
case 'i':
7375
Printable.i = va_arg( vl, int );
7476
printf_s( "%i\n", Printable.i );
75-
break;
77+
break;
7678

7779
case 'f':
7880
Printable.f = va_arg( vl, double );
7981
printf_s( "%f\n", Printable.f );
80-
break;
82+
break;
8183

8284
case 'c':
8385
Printable.c = va_arg( vl, char );
8486
printf_s( "%c\n", Printable.c );
85-
break;
87+
break;
8688

8789
case 's':
8890
Printable.s = va_arg( vl, char * );
8991
printf_s( "%s\n", Printable.s );
90-
break;
92+
break;
9193

9294
default:
93-
break;
95+
break;
9496
}
9597
}
9698
va_end( vl );
9799
}
98-
//Output:
99-
// 32.400002
100-
// a
101-
// Test string
100+
```
101+
102+
```Output
103+
32.400002
104+
a
105+
Test string
102106
```
103107

104108
The previous example illustrates these important concepts:
105109

106110
1. You must establish a list marker as a variable of type `va_list` before any variable arguments are accessed. In the previous example, the marker is called `vl`.
107-
108111
1. The individual arguments are accessed by using the `va_arg` macro. You must tell the `va_arg` macro the type of argument to retrieve so that it can transfer the correct number of bytes from the stack. If you specify an incorrect type of a size different from that supplied by the calling program to `va_arg`, the results are unpredictable.
109-
110112
1. You should explicitly cast the result obtained by using the `va_arg` macro to the type that you want.
111-
112-
You must call the macro to terminate variable-argument processing.`va_end`
113+
1. You must call the `va_end` macro to terminate variable-argument processing.

docs/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ additionalContent:
172172
- text: Mobile development
173173
url: cross-platform/index.yml
174174
- text: Game development
175-
url: /windows/uwp/gaming/e2e/
175+
url: /visualstudio/gamedev/
176176
# Card
177177
- title: Features
178178
links:

docs/preprocessor/warning.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "warning pragma"
33
description: "Learn more about the warning pragma in Microsoft C/C++"
4-
ms.date: 01/22/2021
4+
ms.date: 4/30/2025
55
f1_keywords: ["warning_CPP", "vc-pragma.warning"]
66
helpviewer_keywords: ["pragma, warning", "push pragma warning", "pop warning pragma", "warning pragma"]
77
no-loc: ["pragma"]
@@ -24,7 +24,7 @@ The following warning-specifier parameters are available.
2424

2525
| warning-specifier | Meaning |
2626
|--|--|
27-
| `1`, `2`, `3`, `4` | Apply the given level to the specified warnings. Also turns on a specified warning that is off by default. |
27+
| `1`, `2`, `3`, `4` | Apply the given level to the specified warnings. For example: `#pragma warning (3 : 5033)` turns off warning 5033 (normally a level 1 warning) unless the warning level is set to `/w3` or higher. Also can be used to turn on a specified warning that is off by default. |
2828
| `default` | Reset warning behavior to its default value. Also turns on a specified warning that is off by default. The warning will be generated at its default, documented, level.<br /><br /> For more information, see [Compiler warnings that are off by default](../preprocessor/compiler-warnings-that-are-off-by-default.md). |
2929
| `disable` | Don't issue the specified warning messages. The optional **`justification`** property is allowed. |
3030
| `error` | Report the specified warnings as errors. |
@@ -34,7 +34,7 @@ The following warning-specifier parameters are available.
3434
The following code statement illustrates that a *`warning-number-list`* parameter can contain multiple warning numbers, and that multiple *`warning-specifier`* parameters can be specified in the same pragma directive.
3535

3636
```cpp
37-
#pragma warning( disable : 4507 34; once : 4385; error : 164 )
37+
#pragma warning( disable : 4507 4034; once : 4385; error : 164 )
3838
```
3939

4040
However, when the **`justification`** field is present, only one warning number can be specified. The following code statement illustrates the use of the **`justification`** field.
@@ -50,13 +50,13 @@ This directive is functionally equivalent to the following code:
5050

5151
```cpp
5252
// Disable warning messages 4507 and 4034.
53-
#pragma warning( disable : 4507 34 )
53+
#pragma warning(disable : 4507 4034)
5454

5555
// Issue warning C4385 only once.
56-
#pragma warning( once : 4385 )
56+
#pragma warning(once : 4385)
5757

5858
// Report warning C4164 as an error.
59-
#pragma warning( error : 164 )
59+
#pragma warning(error : 164)
6060
```
6161

6262
The compiler adds 4000 to any warning number that is between 0 and 999.
@@ -67,15 +67,17 @@ Warning numbers in the range 4700-4999 are associated with code generation. For
6767
// pragma_warning.cpp
6868
// compile with: /W1
6969
#pragma warning(disable:4700)
70-
void Test() {
70+
void Test()
71+
{
7172
int x;
72-
int y = x; // no C4700 here
73-
#pragma warning(default:4700) // C4700 enabled after Test ends
73+
int y = x; // no C4700 here
74+
#pragma warning(default:4700) // C4700 enabled after compiling Test()
7475
}
7576

76-
int main() {
77+
int main()
78+
{
7779
int x;
78-
int y = x; // C4700
80+
int y = x; // C4700
7981
}
8082
```
8183

0 commit comments

Comments
 (0)