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
Copy file name to clipboardExpand all lines: docs/assembler/masm/masm-for-x64-ml64-exe.md
+1-2
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,10 @@ description: "Learn more about: Microsoft Macro Assembler (MASM) for x64 (ml64.e
3
3
title: "MASM for x64 (ml64.exe)"
4
4
ms.date: 09/21/2021
5
5
helpviewer_keywords: ["ml64", "ml64.exe", "masm for x64"]
6
-
ms.assetid: 89059103-f372-4968-80ea-0c7f90bb9c91
7
6
---
8
7
# MASM for x64 (ml64.exe)
9
8
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).
11
10
12
11
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).
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
+
15
17
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*.
16
18
17
19
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.
@@ -23,24 +22,22 @@ The following code generates both this warning and [C6201](../code-quality/c6201
23
22
```cpp
24
23
#defineMAX 25
25
24
26
-
voidf ( )
25
+
voidf()
27
26
{
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
31
29
}
32
30
```
33
31
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:
@@ -24,7 +24,7 @@ The following warning-specifier parameters are available.
24
24
25
25
| warning-specifier | Meaning |
26
26
|--|--|
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. |
28
28
|`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). |
29
29
|`disable`| Don't issue the specified warning messages. The optional **`justification`** property is allowed. |
30
30
|`error`| Report the specified warnings as errors. |
@@ -34,7 +34,7 @@ The following warning-specifier parameters are available.
34
34
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.
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:
50
50
51
51
```cpp
52
52
// Disable warning messages 4507 and 4034.
53
-
#pragma warning(disable : 4507 34 )
53
+
#pragma warning(disable : 4507 4034)
54
54
55
55
// Issue warning C4385 only once.
56
-
#pragma warning(once : 4385)
56
+
#pragma warning(once : 4385)
57
57
58
58
// Report warning C4164 as an error.
59
-
#pragma warning(error : 164)
59
+
#pragma warning(error : 164)
60
60
```
61
61
62
62
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
67
67
// pragma_warning.cpp
68
68
// compile with: /W1
69
69
#pragma warning(disable:4700)
70
-
voidTest() {
70
+
voidTest()
71
+
{
71
72
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()
0 commit comments