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/c-runtime-library/reference/vprintf-vprintf-l-vwprintf-vwprintf-l.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,8 +64,7 @@ Each of these functions takes a pointer to an argument list, then formats and wr
64
64
The versions of these functions with the **_l** suffix are identical except that they use the locale parameter passed in instead of the current thread locale.
65
65
66
66
> [!IMPORTANT]
67
-
> Ensure that *format* is not a user-defined string. For more information, see [Avoiding Buffer Overruns](/windows/win32/SecBP/avoiding-buffer-overruns).
68
-
Note that invalid format strings are detected and result in an error.
67
+
> Ensure that *format* is not a user-defined string. For more information, see [Avoiding Buffer Overruns](/windows/win32/SecBP/avoiding-buffer-overruns). Invalid format strings are detected and result in an error.
69
68
> Starting in Windows 10 version 2004 (build 19041), the `printf` family of functions prints exactly representable floating point numbers according to the IEEE 754 rules for rounding. In previous versions of Windows, exactly representable floating point numbers ending in '5' would always round up. IEEE 754 states that they must round to the closest even digit (also known as "Banker's Rounding"). For example, both `printf("%1.0f", 1.5)` and `printf("%1.0f", 2.5)` should round to 2. Previously, 1.5 would round to 2 and 2.5 would round to 3. This change only affects exactly representable numbers. For example, 2.35 (which, when represented in memory, is closer to 2.35000000000000008) continues to round up to 2.4. Rounding done by these functions now also respects the floating point rounding mode set by [`fesetround`](fegetround-fesetround2.md). Previously, rounding always chose `FE_TONEAREST` behavior. This change only affects programs built using Visual Studio 2019 version 16.2 and later. To use the legacy floating point rounding behavior, link with ['legacy_stdio_float_rounding.obj`](../link-options.md).
Copy file name to clipboardExpand all lines: docs/code-quality/c6031.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,7 @@ void test_f()
83
83
}
84
84
```
85
85
86
-
In cases where it is necessary to ignore the return value of a function, assign the returned value to `std::ignore`. Assigning to `std::ignore` clearly indicates developer intent and helps in future code maintenance.
86
+
In cases where it is necessary to ignore the return value of a function, assign the returned value to `std::ignore`. Assigning to `std::ignore` clearly indicates developer intent and helps in future code maintenance.
Copy file name to clipboardExpand all lines: docs/cpp/examples-of-lambda-expressions.md
+10-28Lines changed: 10 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,8 +15,6 @@ This article shows how to use lambda expressions in your programs. For an overvi
15
15
16
16
Because a lambda expression is typed, you can assign it to an **`auto`** variable or to a [`function`](../standard-library/function-class.md) object, as shown here:
17
17
18
-
### Code
19
-
20
18
```cpp
21
19
// declaring_lambda_expressions1.cpp
22
20
// compile with: /EHsc /W4
@@ -40,7 +38,7 @@ int main()
40
38
}
41
39
```
42
40
43
-
### Output
41
+
The example produces this output:
44
42
45
43
```Output
46
44
5
@@ -57,8 +55,6 @@ Although lambda expressions are most often declared in the body of a function, y
57
55
58
56
The Microsoft C++ compiler binds a lambda expression to its captured variables when the expression is declared instead of when the expression is called. The following example shows a lambda expression that captures the local variable `i` by value and the local variable `j` by reference. Because the lambda expression captures `i` by value, the reassignment of `i` later in the program does not affect the result of the expression. However, because the lambda expression captures `j` by reference, the reassignment of `j` does affect the result of the expression.
59
57
60
-
### Code
61
-
62
58
```cpp
63
59
// declaring_lambda_expressions2.cpp
64
60
// compile with: /EHsc /W4
@@ -85,7 +81,7 @@ int main()
85
81
}
86
82
```
87
83
88
-
### Output
84
+
The example produces this output:
89
85
90
86
```Output
91
87
47
@@ -101,8 +97,6 @@ You can call a lambda expression immediately, as shown in the next code snippet.
101
97
102
98
This example declares a lambda expression that returns the sum of two integers and calls the expression immediately with the arguments `5` and `4`:
103
99
104
-
### Code
105
-
106
100
```cpp
107
101
// calling_lambda_expressions1.cpp
108
102
// compile with: /EHsc
@@ -116,7 +110,7 @@ int main()
116
110
}
117
111
```
118
112
119
-
### Output
113
+
The example produces this output:
120
114
121
115
```Output
122
116
9
@@ -126,8 +120,6 @@ int main()
126
120
127
121
This example passes a lambda expression as an argument to the `find_if` function. The lambda expression returns **`true`** if its parameter is an even number.
128
122
129
-
### Code
130
-
131
123
```cpp
132
124
// calling_lambda_expressions2.cpp
133
125
// compile with: /EHsc /W4
@@ -161,7 +153,7 @@ int main()
161
153
}
162
154
```
163
155
164
-
### Output
156
+
The example produces this output:
165
157
166
158
```Output
167
159
The first even number in the list is 42.
@@ -179,8 +171,6 @@ For more information about the `find_if` function, see [`find_if`](../standard-l
179
171
180
172
You can nest a lambda expression inside another one, as shown in this example. The inner lambda expression multiplies its argument by 2 and returns the result. The outer lambda expression calls the inner lambda expression with its argument and adds 3 to the result.
181
173
182
-
### Code
183
-
184
174
```cpp
185
175
// nesting_lambda_expressions.cpp
186
176
// compile with: /EHsc /W4
@@ -199,7 +189,7 @@ int main()
199
189
}
200
190
```
201
191
202
-
### Output
192
+
The example produces this output:
203
193
204
194
```Output
205
195
13
@@ -217,8 +207,6 @@ In this example, `[](int y) { return y * 2; }` is the nested lambda expression.
217
207
218
208
Many programming languages support the concept of a *higher-order function.* A higher-order function is a lambda expression that takes another lambda expression as its argument or returns a lambda expression. You can use the [`function`](../standard-library/function-class.md) class to enable a C++ lambda expression to behave like a higher-order function. The following example shows a lambda expression that returns a `function` object and a lambda expression that takes a `function` object as its argument.
219
209
220
-
### Code
221
-
222
210
```cpp
223
211
// higher_order_lambda_expression.cpp
224
212
// compile with: /EHsc /W4
@@ -252,7 +240,7 @@ int main()
252
240
}
253
241
```
254
242
255
-
### Output
243
+
The example produces this output:
256
244
257
245
```Output
258
246
30
@@ -338,7 +326,7 @@ int main()
338
326
}
339
327
```
340
328
341
-
### Output
329
+
The example produces this output:
342
330
343
331
```Output
344
332
3
@@ -359,8 +347,6 @@ The `ApplyScale` function uses a lambda expression to print the product of the s
359
347
360
348
Because lambda expressions are typed, you can use them with C++ templates. The following example shows the `negate_all` and `print_all` functions. The `negate_all` function applies the unary **`operator-`** to each element in the `vector` object. The `print_all` function prints each element in the `vector` object to the console.
361
349
362
-
### Code
363
-
364
350
```cpp
365
351
// template_lambda_expression.cpp
366
352
// compile with: /EHsc
@@ -399,7 +385,7 @@ int main()
399
385
}
400
386
```
401
387
402
-
### Output
388
+
The example produces this output:
403
389
404
390
```Output
405
391
34
@@ -423,8 +409,6 @@ For more information about C++ templates, see [Templates](../cpp/templates-cpp.m
423
409
424
410
The body of a lambda expression follows the rules for both structured exception handling (SEH) and C++ exception handling. You can handle a raised exception in the body of a lambda expression or defer exception handling to the enclosing scope. The following example uses the **`for_each`** function and a lambda expression to fill a `vector` object with the values of another one. It uses a **`try`**/**`catch`** block to handle invalid access to the first vector.
425
411
426
-
### Code
427
-
428
412
```cpp
429
413
// eh_lambda_expression.cpp
430
414
// compile with: /EHsc /W4
@@ -461,7 +445,7 @@ int main()
461
445
}
462
446
```
463
447
464
-
### Output
448
+
The example produces this output:
465
449
466
450
```Output
467
451
Caught 'invalid vector<T> subscript'.
@@ -479,8 +463,6 @@ For more information about exception handling, see [Exception Handling](../cpp/e
479
463
480
464
The capture clause of a lambda expression cannot contain a variable that has a managed type. However, you can pass an argument that has a managed type to the parameter list of a lambda expression. The following example contains a lambda expression that captures the local unmanaged variable `ch` by value and takes a <xref:System.String?displayProperty=fullName> object as its parameter.
Copy file name to clipboardExpand all lines: docs/dotnet/dotnet-programming-with-cpp-cli-visual-cpp.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ C++/CLI itself isn't installed by default when you install a Visual Studio C++ w
23
23
::: moniker range="msvc-160"
24
24
25
25
In Visual Studio 2019, the default target framework for .NET Core projects is 5.0. For .NET Frameworks projects, the default is 4.7.2. The .NET Framework version selector is on the **Configure your new project** page of the **Create a new project** dialog.
26
+
26
27
## Install C++/CLI support in Visual Studio 2019
27
28
28
29
C++/CLI itself isn't installed by default when you install a Visual Studio C++ workload. To install the component after Visual Studio is installed, open the Visual Studio Installer. Choose the **Modify** button next to your installed version of Visual Studio. Select the **Installed components** tab. Scroll down to the **Compilers, build tools, and runtimes** section, and select the latest **C++/CLI support for v142 build tools** component. Choose **Modify** to update Visual Studio.
0 commit comments