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
* changed Visual C++ to various other branded strings
* fixed some spacing
* changed Visual C++ compiler to Microsoft C++ compiler per product team request
* Partial scan of branding
* Additional branding fixes.
* Remove obsolete link
* Fix a clunky bit
helpviewer_keywords: ["cl.exe compiler", "IPF Visual C++ compiler", "Itanium Visual C++ compiler", "compiler options, C++", "x64 Visual C++ compiler"]
11
+
helpviewer_keywords: ["cl.exe compiler", "x86 Visual C++ compiler", "ARM Visual C++ compiler", "compiler options, C++", "x64 Visual C++ compiler"]
12
12
ms.assetid: ed3376c8-bef4-4c9a-80e9-3b5da232644c
13
13
caps.latest.revision: 18
14
14
author: "corob-msft"
@@ -17,42 +17,43 @@ manager: "ghogen"
17
17
ms.workload: ["cplusplus"]
18
18
---
19
19
# Compiler Options
20
-
cl.exe is a tool that controls the Microsoft C and C++ compilers and linker. cl.exe can be run only on operating systems that support Microsoft Visual Studio.
21
-
22
-
> [!NOTE]
23
-
> You can start this tool only from the [!INCLUDE[vsprvs](../../assembler/masm/includes/vsprvs_md.md)] command prompt. You cannot start it from a system command prompt or from File Explorer.
24
-
25
-
The compilers produce Common Object File Format (COFF) object (.obj) files. The linker produces executable (.exe) files or dynamic-link libraries (DLLs).
26
-
27
-
Note that all compiler options are case sensitive.
28
-
29
-
To compile without linking, use [/c](../../build/reference/c-compile-without-linking.md).
30
-
31
-
## Finding an Option
32
-
To find a particular compiler option, see one of the following lists:
-[Compiler Options Listed by Category](../../build/reference/compiler-options-listed-by-category.md)
37
-
38
-
## Specifying Options
39
-
The topic for each compiler option discusses how it can be set in the development environment. For information on specifying options outside the development environment, see:
[CL Invokes the Linker](../../build/reference/cl-invokes-the-linker.md)
20
+
21
+
cl.exe is a tool that controls the Microsoft Visual C++ (MSVC) C and C++ compilers and linker. cl.exe can be run only on operating systems that support Microsoft Visual Studio for Windows.
22
+
23
+
> [!NOTE]
24
+
> You can start this tool only from a Visual Studio developer command prompt. You cannot start it from a system command prompt or from File Explorer. For more information, see [Build C/C++ code on the command line](../building-on-the-command-line.md).
25
+
26
+
The compilers produce Common Object File Format (COFF) object (.obj) files. The linker produces executable (.exe) files or dynamic-link libraries (DLLs).
27
+
28
+
Note that all compiler options are case sensitive. You may use either a forward slash (`/`) or a dash (`-`) to specify a compiler option.
29
+
30
+
To compile without linking, use the [/c](../../build/reference/c-compile-without-linking.md) option.
31
+
32
+
## Find a compiler option
33
+
34
+
To find a particular compiler option, see one of the following lists:
-[Compiler Options Listed by Category](../../build/reference/compiler-options-listed-by-category.md)
39
+
40
+
## Specify compiler options
41
+
42
+
The topic for each compiler option discusses how it can be set in the development environment. For information on specifying options outside the development environment, see:
Copy file name to clipboardExpand all lines: docs/build/reference/volatile-volatile-keyword-interpretation.md
+36-36Lines changed: 36 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -18,39 +18,39 @@ manager: "ghogen"
18
18
ms.workload: ["cplusplus"]
19
19
---
20
20
# /volatile (volatile Keyword Interpretation)
21
-
Specifies how the [volatile](../../cpp/volatile-cpp.md) keyword is to be interpreted.
22
-
23
-
## Syntax
24
-
25
-
```
26
-
/volatile:{iso|ms}
27
-
```
28
-
29
-
## Arguments
30
-
**/volatile:iso**
31
-
Selects strict `volatile` semantics as defined by the ISO-standard C++ language. Acquire/release semantics are not guaranteed on volatile accesses. If the compiler targets ARM, this is the default interpretation of `volatile`.
32
-
33
-
**/volatile:ms**
34
-
Selects Microsoft extended `volatile` semantics, which add memory ordering guarantees beyond the ISO-standard C++ language. Acquire/release semantics are guaranteed on volatile accesses. However, this option also forces the compiler to generate hardware memory barriers, which might add significant overhead on ARM and other weak memory-ordering architectures. If the compiler targets any platform except ARM, this is default interpretation of `volatile`.
35
-
36
-
## Remarks
37
-
We strongly recommend that you use **/volatile:iso** along with explicit synchronization primitives and compiler intrinsics when you are dealing with memory that is shared across threads. For more information, see [volatile](../../cpp/volatile-cpp.md).
38
-
39
-
If you port existing code or change this option in the middle of a project, it may be helpful to enable warning [C4746](../../error-messages/compiler-warnings/compiler-warning-c4746.md) to identify code locations that are affected by the difference in semantics.
40
-
41
-
There is no `#pragma` equivalent to control this option.
42
-
43
-
### To set the /volatile compiler option in Visual Studio
44
-
45
-
1. Open the **Property Pages** dialog box for the project. For more information, see [Working with Project Properties](../../ide/working-with-project-properties.md).
46
-
47
-
2. Select the **C/C++** folder.
48
-
49
-
3. Select the **Command Line** property page.
50
-
51
-
4. In the **Additional options** box, add `/volatile:iso` or `/volatile:ms`.
Specifies how the [volatile](../../cpp/volatile-cpp.md) keyword is to be interpreted.
23
+
24
+
## Syntax
25
+
26
+
> **/volatile:**{**iso**|**ms**}
27
+
28
+
## Arguments
29
+
30
+
**/volatile:iso**
31
+
Selects strict `volatile` semantics as defined by the ISO-standard C++ language. Acquire/release semantics are not guaranteed on volatile accesses. If the compiler targets ARM, this is the default interpretation of `volatile`.
32
+
33
+
**/volatile:ms**
34
+
Selects Microsoft extended `volatile` semantics, which add memory ordering guarantees beyond the ISO-standard C++ language. Acquire/release semantics are guaranteed on volatile accesses. However, this option also forces the compiler to generate hardware memory barriers, which might add significant overhead on ARM and other weak memory-ordering architectures. If the compiler targets any platform except ARM, this is default interpretation of `volatile`.
35
+
36
+
## Remarks
37
+
38
+
We strongly recommend that you use **/volatile:iso** along with explicit synchronization primitives and compiler intrinsics when you are dealing with memory that is shared across threads. For more information, see [volatile](../../cpp/volatile-cpp.md).
39
+
40
+
If you port existing code or change this option in the middle of a project, it may be helpful to enable warning [C4746](../../error-messages/compiler-warnings/compiler-warning-c4746.md) to identify code locations that are affected by the difference in semantics.
41
+
42
+
There is no `#pragma` equivalent to control this option.
43
+
44
+
### To set the /volatile compiler option in Visual Studio
45
+
46
+
1. Open the **Property Pages** dialog box for the project. For more information, see [Working with Project Properties](../../ide/working-with-project-properties.md).
The operands of bitwise operators must have integral types, but their types can be different. These operators perform the usual arithmetic conversions; the type of the result is the type of the operands after conversion.
40
-
41
-
The C bitwise operators are described below:
42
-
43
-
|Operator|Description|
44
-
|--------------|-----------------|
45
-
|**&**|The bitwise-AND operator compares each bit of its first operand to the corresponding bit of its second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.|
46
-
|**^**|The bitwise-exclusive-OR operator compares each bit of its first operand to the corresponding bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.|
47
-
|**|**|The bitwise-inclusive-OR operator compares each bit of its first operand to the corresponding bit of its second operand. If either bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.|
48
-
49
-
## Examples
50
-
These declarations are used for the following three examples:
51
-
52
-
```
53
-
short i = 0xAB00;
54
-
short j = 0xABCD;
55
-
short n;
56
-
57
-
n = i & j;
58
-
```
59
-
60
-
The result assigned to `n` in this first example is the same as `i` (0xAB00 hexadecimal).
61
-
62
-
```
63
-
n = i | j;
64
-
65
-
n = i ^ j;
66
-
```
67
-
68
-
The bitwise-inclusive OR in the second example results in the value 0xABCD (hexadecimal), while the bitwise-exclusive OR in the third example produces 0xCD (hexadecimal).
69
-
70
-
**Microsoft Specific**
71
-
72
-
The results of bitwise operation on signed integers is implementation-defined according to the ANSI C standard. For the Microsoft C compiler, bitwise operations on signed integers work the same as bitwise operations on unsigned integers. For example, `-16 & 99` can be expressed in binary as
73
-
74
-
```
75
-
11111111 11110000
76
-
& 00000000 01100011
77
-
_________________
78
-
00000000 01100000
79
-
```
80
-
81
-
The result of the bitwise AND is 96 decimal.
82
-
83
-
**END Microsoft Specific**
84
-
85
-
## See Also
86
-
[Bitwise AND Operator: &](../cpp/bitwise-and-operator-amp.md)
87
-
[Bitwise Exclusive OR Operator: ^](../cpp/bitwise-exclusive-or-operator-hat.md)
88
-
[Bitwise Inclusive OR Operator: |](../cpp/bitwise-inclusive-or-operator-pipe.md)
20
+
21
+
The bitwise operators perform bitwise-AND (**&**), bitwise-exclusive-OR (**^**), and bitwise-inclusive-OR (**|**) operations.
The operands of bitwise operators must have integral types, but their types can be different. These operators perform the usual arithmetic conversions; the type of the result is the type of the operands after conversion.
38
+
39
+
The C bitwise operators are described below:
40
+
41
+
|Operator|Description|
42
+
|--------------|-----------------|
43
+
|**&**|The bitwise-AND operator compares each bit of its first operand to the corresponding bit of its second operand. If both bits are 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.|
44
+
|**^**|The bitwise-exclusive-OR operator compares each bit of its first operand to the corresponding bit of its second operand. If one bit is 0 and the other bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.|
45
+
|**|**|The bitwise-inclusive-OR operator compares each bit of its first operand to the corresponding bit of its second operand. If either bit is 1, the corresponding result bit is set to 1. Otherwise, the corresponding result bit is set to 0.|
46
+
47
+
## Examples
48
+
49
+
These declarations are used for the following three examples:
50
+
51
+
```C
52
+
short i = 0xAB00;
53
+
shortj = 0xABCD;
54
+
shortn;
55
+
56
+
n = i & j;
57
+
```
58
+
59
+
The result assigned to `n` in this first example is the same as `i` (0xAB00 hexadecimal).
60
+
61
+
```C
62
+
n = i | j;
63
+
64
+
n = i ^ j;
65
+
```
66
+
67
+
The bitwise-inclusive OR in the second example results in the value 0xABCD (hexadecimal), while the bitwise-exclusive OR in the third example produces 0xCD (hexadecimal).
68
+
69
+
**Microsoft Specific**
70
+
71
+
The results of bitwise operation on signed integers is implementation-defined according to the ANSI C standard. For the Microsoft C compiler, bitwise operations on signed integers work the same as bitwise operations on unsigned integers. For example, `-16 & 99` can be expressed in binary as
72
+
73
+
```Expression
74
+
11111111 11110000
75
+
& 00000000 01100011
76
+
_________________
77
+
00000000 01100000
78
+
```
79
+
80
+
The result of the bitwise AND is 96 decimal.
81
+
82
+
**END Microsoft Specific**
83
+
84
+
## See also
85
+
86
+
[Bitwise AND Operator: &](../cpp/bitwise-and-operator-amp.md)
87
+
[Bitwise Exclusive OR Operator: ^](../cpp/bitwise-exclusive-or-operator-hat.md)
88
+
[Bitwise Inclusive OR Operator: |](../cpp/bitwise-inclusive-or-operator-pipe.md)
A "pragma" instructs the compiler to perform a particular action at compile time. Pragmas vary from compiler to compiler. For example, you can use the **optimize** pragma to set the optimizations to perform on your program. The Microsoft C pragmas are:
See [Pragma Directives and the __Pragma Keyword](../preprocessor/pragma-directives-and-the-pragma-keyword.md) in the *Preprocessor Reference* for a description of the Microsoft C compiler pragmas.
33
-
34
-
**END Microsoft Specific**
35
-
36
-
## See Also
37
-
[Source Files and Source Programs](../c-language/source-files-and-source-programs.md)
20
+
21
+
**Microsoft Specific**
22
+
23
+
A *pragma* instructs the compiler to perform a particular action at compile time. Pragmas vary from compiler to compiler. For example, you can use the **optimize** pragma to set the optimizations to perform on your program. The Microsoft C pragmas are:
See [Pragma Directives and the __Pragma Keyword](../preprocessor/pragma-directives-and-the-pragma-keyword.md) for a description of the Microsoft C compiler pragmas.
34
+
35
+
**END Microsoft Specific**
36
+
37
+
## See also
38
+
39
+
[Source Files and Source Programs](../c-language/source-files-and-source-programs.md)
0 commit comments