Skip to content

Commit bbcd13c

Browse files
author
Colin Robertson
authored
Merge pull request #3585 from MicrosoftDocs/main637747576150781038
Repo sync for protected CLA branch
2 parents e419575 + b7a09e4 commit bbcd13c

14 files changed

+443
-66
lines changed

docs/build/reference/makefile-preprocessing.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
description: "Learn more about: Makefile Preprocessing"
3-
title: "Makefile Preprocessing"
3+
title: "Makefile preprocessing"
44
ms.date: 09/30/2021
55
f1_keywords: ["!UNDEF", "!INCLUDE", "!IFNDEF", "!MESSAGE"]
66
helpviewer_keywords: ["preprocessing makefiles", "makefiles, preprocessing", "!CMDSWITCHES directive", "!ELSE directive", "!ELSEIF directive", "!ELSEIFDEF directive", "!ELSEIFNDEF directive", "!ENDIF directive", "!ERROR directive", "!IF directive", "!IFDEF directive", "!IFNDEF directive", "!INCLUDE directive", "!MESSAGE directive", "!UNDEF directive", "directives, makefile preprocessing", "preprocessing directives, makefiles", "NMAKE program, expressions", "NMAKE program, preprocessor directives", "makefiles, preprocessing directives", "expressions [C++], makefile preprocessing", "operators [C++], makefile preprocessing", "EXIST operator", "preprocessing NMAKE makefile operators", "NMAKE program, operators", "DEFINED operator", "makefiles, preprocessing operators"]
77
---
8-
# Makefile Preprocessing
8+
# Makefile preprocessing
99

1010
You can control the NMAKE session by using preprocessing directives and expressions. Preprocessing instructions can be placed in the makefile or in *`Tools.ini`*. Using directives, you can conditionally process your makefile, display error messages, include other makefiles, undefine a macro, and turn certain options on or off.
1111

@@ -129,6 +129,14 @@ Expressions can use the following operators. The operators of equal precedence a
129129

130130
To use a command's exit code during preprocessing, specify the command, with any arguments, within brackets (**`[ ]`**). Any macros are expanded before the command is executed. NMAKE replaces the command specification with the command's exit code, which can be used in an expression to control preprocessing.
131131

132+
### Example
133+
134+
```Makefile
135+
!IF [my_command.exe arg1 arg2] != 0
136+
!MESSAGE my_command.exe failed!
137+
!ENDIF
138+
```
139+
132140
## See also
133141

134142
[NMAKE Reference](nmake-reference.md)

docs/build/reference/z7-zi-zi-debug-information-format.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
description: "Learn more about: /Z7, /Zi, /ZI (Debug Information Format)"
33
title: "/Z7, /Zi, /ZI (Debug Information Format)"
4-
ms.date: "07/06/2020"
4+
ms.date: 12/09/2021
55
f1_keywords: ["VC.Project.VCCLCompilerTool.DebugInformationFormat", "/ZI", "/Zi", "/Z7", "VC.Project.VCCLWCECompilerTool.DebugInformationFormat"]
66
helpviewer_keywords: ["C7 compatible compiler option [C++]", "Debug Information Format compiler option", "ZI compiler option", "-Zi compiler option [C++]", "/ZI compiler option [C++]", "Z7 compiler option [C++]", "debugging [C++], debug information files", "Zi compiler option [C++]", "/Zi compiler option [C++]", "program database compiler option [C++]", "full symbolic debugging information", "/Z7 compiler option [C++]", "line numbers only compiler option [C++]", "cl.exe compiler, debugging options", "-Z7 compiler option [C++]"]
77
---
8-
# /Z7, /Zi, /ZI (Debug Information Format)
8+
# `/Z7`, `/Zi`, `/ZI` (Debug Information Format)
99

1010
The **`/Z7`**, **`/Zi`**, and **`/ZI`** compiler options specify the type of debugging information created for your program, and whether this information is kept in object files or in a program database (PDB) file.
1111

@@ -23,15 +23,15 @@ When you specify a debug option, the compiler produces symbol names for function
2323

2424
By default, if no debug information format option is specified, the compiler produces no debugging information, so compilation is faster.
2525

26-
### /Z7
26+
### `/Z7`
2727

2828
The **`/Z7`** option produces object files that also contain full symbolic debugging information for use with the debugger. These object files and any libraries built from them can be substantially larger than files that have no debugging information. The symbolic debugging information includes the names and types of variables, functions, and line numbers. No PDB file is produced by the compiler. However, a PDB file can still be generated from these object files or libraries if the linker is passed the **`/DEBUG`** option.
2929

3030
For distributors of debug versions of third-party libraries, there's an advantage to not having a PDB file. However, the object files for any precompiled headers are necessary during the library link phase, and for debugging. If there's only type information (and no code) in the *`.pch`* object file, you must also use the [`/Yl` (Inject PCH Reference for Debug Library)](yl-inject-pch-reference-for-debug-library.md) option, which is enabled by default, when you build the library.
3131

3232
The deprecated [`/Gm` (Enable Minimal Rebuild)](gm-enable-minimal-rebuild.md) option is unavailable when **`/Z7`** is specified.
3333

34-
### /Zi
34+
### `/Zi`
3535

3636
The **`/Zi`** option produces a separate PDB file that contains all the symbolic debugging information for use with the debugger. The debugging information isn't included in the object files or executable, which makes them much smaller.
3737

@@ -43,7 +43,7 @@ The compiler names the PDB file *`<project>.pdb`*, where *`<project>`* is the na
4343

4444
If you create a library from objects that were compiled using **`/Zi`**, the associated PDB file must be available when the library is linked to a program. That means, if you distribute the library, you must also distribute the PDB file. To create a library that contains debugging information without using PDB files, you must select the **`/Z7`** option. If you use the precompiled headers options, debugging information for both the precompiled header and the rest of the source code is placed in the PDB file.
4545

46-
### /ZI
46+
### `/ZI`
4747

4848
The **`/ZI`** option is similar to **`/Zi`**, but it produces a PDB file in a format that supports the [Edit and Continue](/visualstudio/debugger/edit-and-continue-visual-cpp) feature. To use Edit and Continue debugging features, you must use this option. The Edit and Continue feature is useful for developer productivity, but can cause issues in code size, performance, and compiler conformance. Because most optimizations are incompatible with Edit and Continue, using **`/ZI`** disables any `#pragma optimize` statements in your code. The **`/ZI`** option is also incompatible with use of the [`__LINE__` predefined macro](../../preprocessor/predefined-macros.md); code compiled with **`/ZI`** can't use `__LINE__` as a non-type template argument, although `__LINE__` can be used in macro expansions.
4949

docs/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Walkthrough: Create and use your own Dynamic Link Library (C++)"
33
description: "Use C++ to create a Windows dynamic-link library (DLL) in Visual Studio."
44
ms.custom: "contperf-fy21q2"
55
ms.topic: tutorial
6-
ms.date: "08/22/2019"
6+
ms.date: 12/09/2021
77
helpviewer_keywords: ["libraries [C++], DLLs", "DLLs [C++], walkthroughs"]
88
---
99
# Walkthrough: Create and use your own Dynamic Link Library (C++)
@@ -30,6 +30,8 @@ This walkthrough creates two Visual Studio solutions; one that builds the DLL, a
3030

3131
This walkthrough doesn't cover some common situations. The code doesn't show the use of C++ DLLs by other programming languages. It doesn't show how to [create a resource-only DLL](creating-a-resource-only-dll.md), or how to use [explicit linking](linking-an-executable-to-a-dll.md#linking-explicitly) to load DLLs at run-time rather than at load-time. Rest assured, you can use MSVC and Visual Studio to do all these things.
3232

33+
Even though the code of the DLL is written in C++, we've used C-style interfaces for the exported functions. There are two main reasons for this: First, many other languages support imports of C-style functions. The client app doesn't have to be written in C++. Second, it avoids some common pitfalls related to exported classes and member functions. It's easy to make hard-to-diagnose errors when exporting classes, since everything referred to within a class declaration has to have an instantiation that's also exported. This restriction applies to DLLs, but not static libraries. If your classes are plain-old-data style, you shouldn't run into this issue.
34+
3335
For links to more information about DLLs, see [Create C/C++ DLLs in Visual Studio](dlls-in-visual-cpp.md). For more information about implicit linking and explicit linking, see [Determine which linking method to use](linking-an-executable-to-a-dll.md#determining-which-linking-method-to-use). For information about creating C++ DLLs for use with programming languages that use C-language linkage conventions, see [Exporting C++ functions for use in C-language executables](exporting-cpp-functions-for-use-in-c-language-executables.md). For information about how to create DLLs for use with .NET languages, see [Calling DLL Functions from Visual Basic Applications](calling-dll-functions-from-visual-basic-applications.md).
3436

3537
## Prerequisites

docs/c-language/parsing-c-command-line-arguments.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
2-
title: "Parsing C Command-Line Arguments"
2+
title: "Parsing C command-line arguments"
33
description: "Learn how the Microsoft C runtime startup code interprets command-line arguments to create the argv and argc parameters."
4-
ms.date: 11/09/2020
4+
ms.date: 12/09/2021
55
helpviewer_keywords: ["quotation marks, command-line arguments", "double quotation marks", "double quote marks", "command line, parsing", "parsing, command-line arguments", "startup code, parsing command-line arguments"]
66
ms.assetid: ffce8037-2811-45c4-8db4-1ed787859c80
77
---
8-
# Parsing C Command-Line Arguments
8+
# Parsing C command-line arguments
99

1010
**Microsoft Specific**
1111

1212
Microsoft C startup code uses the following rules when interpreting arguments given on the operating system command line:
1313

14-
- Arguments are delimited by white space, which is either a space or a tab.
14+
- Arguments are delimited by whitespace characters, which are either spaces or tabs.
1515

1616
- The first argument (`argv[0]`) is treated specially. It represents the program name. Because it must be a valid pathname, parts surrounded by double quote marks (**`"`**) are allowed. The double quote marks aren't included in the `argv[0]` output. The parts surrounded by double quote marks prevent interpretation of a space or tab character as the end of the argument. The later rules in this list don't apply.
1717

18-
- A string surrounded by double quote marks is interpreted as a single argument, whether or not it contains white space. A quoted string can be embedded in an argument. The caret (**`^`**) isn't recognized as an escape character or delimiter. Within a quoted string, a pair of double quote marks is interpreted as a single escaped double quote mark. If the command line ends before a closing double quote mark is found, then all the characters read so far are output as the last argument.
18+
- A string surrounded by double quote marks is interpreted as a single argument, whether it contains whitespace characters or not. A quoted string can be embedded in an argument. The caret (**`^`**) isn't recognized as an escape character or delimiter. Within a quoted string, a pair of double quote marks is interpreted as a single escaped double quote mark. If the command line ends before a closing double quote mark is found, then all the characters read so far are output as the last argument.
1919

2020
- A double quote mark preceded by a backslash (**`\"`**) is interpreted as a literal double quote mark (**`"`**).
2121

@@ -27,14 +27,14 @@ Microsoft C startup code uses the following rules when interpreting arguments gi
2727

2828
This list illustrates the rules above by showing the interpreted result passed to `argv` for several examples of command-line arguments. The output listed in the second, third, and fourth columns is from the ARGS.C program that follows the list.
2929

30-
|Command-Line Input|argv[1]|argv[2]|argv[3]|
31-
|-------------------------|---------------|---------------|---------------|
32-
|`"a b c" d e`|`a b c`|`d`|`e`|
33-
|`"ab\"c" "\\" d`|`ab"c`|`\`|`d`|
34-
|`a\\\b d"e f"g h`|`a\\\b`|`de fg`|`h`|
35-
|`a\\\"b c d`|`a\"b`|`c`|`d`|
36-
|`a\\\\"b c" d e`|`a\\b c`|`d`|`e`|
37-
|`a"b"" c d`|`ab" c d`|||
30+
| Command-line input | `argv[1]` | `argv[2]` | `argv[3]` |
31+
|--|--|--|--|
32+
| `"a b c" d e` | `a b c` | `d` | `e` |
33+
| `"ab\"c" "\\" d` | `ab"c` | `\` | `d` |
34+
| `a\\\b d"e f"g h` | `a\\\b` | `de fg` | `h` |
35+
| `a\\\"b c d` | `a\"b` | `c` | `d` |
36+
| `a\\\\"b c" d e` | `a\\b c` | `d` | `e` |
37+
| `a"b"" c d` | `ab" c d` | | |
3838

3939
## Example
4040

@@ -68,17 +68,14 @@ char **envp ) // Array of environment variable strings
6868
}
6969
```
7070
71-
## Comments
72-
7371
One example of output from this program is:
7472
7573
```
7674
Command-line arguments:
77-
argv[0] C:\MSC\TEST.EXE
75+
argv[0] C:\MSC\ARGS.EXE
7876

7977
Environment variables:
8078
COMSPEC=C:\NT\SYSTEM32\CMD.EXE
81-
8279
PATH=c:\nt;c:\binb;c:\binr;c:\nt\system32;c:\word;c:\help;c:\msc;c:\;
8380
PROMPT=[$p]
8481
TEMP=c:\tmp
@@ -91,4 +88,4 @@ Environment variables:
9188
9289
## See also
9390
94-
[main Function and Program Execution](../c-language/main-function-and-program-execution.md)
91+
[`main` function and program execution](../c-language/main-function-and-program-execution.md)

docs/cpp/left-shift-and-right-shift-operators-input-and-output.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
---
2-
description: "Learn more about: Left Shift and Right Shift Operators (>> and <<)"
3-
title: "Left Shift and Right Shift Operators (>> and <<)"
4-
ms.date: "08/13/2018"
2+
description: "Learn more about: Left shift and right shift operators ('<<' and '>>')"
3+
title: "Left shift and right shift operators ('<<' and '>>')"
4+
ms.date: 12/09/2021
55
f1_keywords: ["<<", ">>"]
66
helpviewer_keywords: ["<< operator [C++], with specific objects", "left shift operators [C++]", "right shift operators [C++]", "bitwise-shift operators [C++]", ">> operator", "shift operators [C++]", "operators [C++], shift"]
77
ms.assetid: 25fa0cbb-5fdd-4657-8745-b35f7d8f1606
88
---
9-
# Left Shift and Right Shift Operators (`<<` and `>>`)
9+
# Left shift and right shift operators (`<<` and `>>`)
1010

11-
The bitwise shift operators are the right-shift operator (**`>>`**), which moves the bits of *shift-expression* to the right, and the left-shift operator (**`<<`**), which moves the bits of *shift-expression* to the left. <sup>1</sup>
11+
The bitwise shift operators are the right-shift operator (**`>>`**), which moves the bits of an integer or enumeration type expression to the right, and the left-shift operator (**`<<`**), which moves the bits to the left. <sup>1</sup>
1212

1313
## Syntax
1414

15-
> *shift-expression* `<<` *additive-expression*\
16-
> *shift-expression* `>>` *additive-expression*
15+
*`shift-expression`*:\
16+
&emsp *`additive-expression`*\
17+
&emsp *`shift-expression`* **`<<`** *`additive-expression`*\
18+
&emsp *`shift-expression`* **`>>`** *`additive-expression`*
1719

1820
## Remarks
1921

@@ -22,7 +24,7 @@ The bitwise shift operators are the right-shift operator (**`>>`**), which moves
2224
2325
## Left Shifts
2426

25-
The left-shift operator causes the bits in *shift-expression* to be shifted to the left by the number of positions specified by *additive-expression*. The bit positions that have been vacated by the shift operation are zero-filled. A left shift is a logical shift (the bits that are shifted off the end are discarded, including the sign bit). For more information about the kinds of bitwise shifts, see [Bitwise shifts](https://en.wikipedia.org/wiki/Bitwise_shift).
27+
The left-shift operator causes the bits in *`shift-expression`* to be shifted to the left by the number of positions specified by *`additive-expression`*. The bit positions that have been vacated by the shift operation are zero-filled. A left shift is a logical shift (the bits that are shifted off the end are discarded, including the sign bit). For more information about the kinds of bitwise shifts, see [Bitwise shifts](https://en.wikipedia.org/wiki/Bitwise_shift).
2628

2729
The following example shows left-shift operations using unsigned numbers. The example shows what is happening to the bits by representing the value as a bitset. For more information, see [bitset Class](../standard-library/bitset-class.md).
2830

@@ -72,7 +74,7 @@ int main() {
7274

7375
## Right Shifts
7476

75-
The right-shift operator causes the bit pattern in *shift-expression* to be shifted to the right by the number of positions specified by *additive-expression*. For unsigned numbers, the bit positions that have been vacated by the shift operation are zero-filled. For signed numbers, the sign bit is used to fill the vacated bit positions. In other words, if the number is positive, 0 is used, and if the number is negative, 1 is used.
77+
The right-shift operator causes the bit pattern in *`shift-expression`* to be shifted to the right by the number of positions specified by *`additive-expression`*. For unsigned numbers, the bit positions that have been vacated by the shift operation are zero-filled. For signed numbers, the sign bit is used to fill the vacated bit positions. In other words, if the number is positive, 0 is used, and if the number is negative, 1 is used.
7678

7779
> [!IMPORTANT]
7880
> The result of a right-shift of a signed negative number is implementation-dependent. Although the Microsoft C++ compiler uses the sign bit to fill vacated bit positions, there is no guarantee that other implementations also do so.
@@ -158,9 +160,9 @@ int main() {
158160
}
159161
```
160162

161-
## Shifts and Promotions
163+
## Shifts and promotions
162164

163-
The expressions on both sides of a shift operator must be integral types. Integral promotions are performed according to the rules described in [Standard Conversions](standard-conversions.md). The type of the result is the same as the type of the promoted *shift-expression*.
165+
The expressions on both sides of a shift operator must be integral types. Integral promotions are performed according to the rules described in [Standard Conversions](standard-conversions.md). The type of the result is the same as the type of the promoted *`shift-expression`*.
164166

165167
In the following example, a variable of type **`char`** is promoted to an **`int`**.
166168

@@ -181,9 +183,9 @@ int main() {
181183
}
182184
```
183185

184-
## Additional Details
186+
## Details
185187

186-
The result of a shift operation is undefined if *additive-expression* is negative or if *additive-expression* is greater than or equal to the number of bits in the (promoted) *shift-expression*. No shift operation is performed if *additive-expression* is 0.
188+
The result of a shift operation is undefined if *`additive-expression`* is negative or if *`additive-expression`* is greater than or equal to the number of bits in the (promoted) *`shift-expression`*. No shift operation takes place if *`additive-expression`* is 0.
187189

188190
```cpp
189191
#include <iostream>
@@ -216,5 +218,5 @@ The value of `E1 >> E2` is `E1` right-shifted `E2` bit positions. If `E1` has an
216218

217219
## See also
218220

219-
[Expressions with Binary Operators](../cpp/expressions-with-binary-operators.md)<br/>
220-
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)
221+
[Expressions with binary operators](../cpp/expressions-with-binary-operators.md)<br/>
222+
[C++ built-in operators, precedence, and associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)

docs/cpp/media/add-module.png

26.4 KB
Loading
61.1 KB
Loading

docs/cpp/media/language-switch.png

57.5 KB
Loading

docs/cpp/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,8 @@ items:
554554
href: ../cpp/modules-cpp.md
555555
- name: module, import, export
556556
href: ../cpp/import-export-module.md
557+
- name: Named modules tutorial in C++
558+
href: ../cpp/tutorial-named-modules-cpp.md
557559
- name: Templates
558560
items:
559561
- name: Templates

0 commit comments

Comments
 (0)