Skip to content

Commit b794912

Browse files
authored
Merge branch 'main' into main638442232968730779sync_temp
2 parents 8a13238 + 9271243 commit b794912

File tree

51 files changed

+333
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+333
-173
lines changed

docs/build/reference/sourcedependencies.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "/sourceDependencies (Report source-level dependencies)"
33
description: "Describes the /sourceDependencies compiler option in Microsoft C++."
4-
ms.date: 05/19/2022
4+
ms.date: 02/23/2024
55
author: "tylermsft"
66
ms.author: "twhitney"
77
f1_keywords: ["/sourceDependencies"]
@@ -65,7 +65,7 @@ where `...` represents your other compiler options. This command line produces a
6565

6666
```JSON
6767
{
68-
"Version": "1.1",
68+
"Version": "1.2",
6969
"Data": {
7070
"Source": "F:\\Sample\\myproject\\modulee.ixx",
7171
"ProvidedModule": "ModuleE",
@@ -88,10 +88,6 @@ where `...` represents your other compiler options. This command line produces a
8888
{
8989
"Header": "f:\\visual studio 16 main\\vc\\tools\\msvc\\14.29.30030\\include\\iostream",
9090
"BMI": "F:\\Sample\\Outputs\\Intermediate\\HeaderUnits\\x64\\Debug\\iostream_W4L4JYGFJ3GL8OG9.ifc"
91-
},
92-
{
93-
"Header": "f:\\visual studio 16 main\\vc\\tools\\msvc\\14.29.30030\\include\\yvals_core.h",
94-
"BMI": "F:\\Sample\\Outputs\\Intermediate\\HeaderUnits\\x64\\Debug\\yvals_core.h.ifc"
9591
}
9692
]
9793
}

docs/build/reference/winmd-generate-windows-metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The linker generates only the .winmd file, but not the binary executable file.
2424

2525
## Remarks
2626

27-
The **/WINMD** linker option is used for UWP apps and Windows runtime components to control the creation of a Windows Runtime metadata (.winmd) file. A .winmd file is a kind of DLL that contains metadata for Windows runtime types and, in the case of runtime components, the implementations of those types. The metadata follows the [ECMA-335](https://www.ecma-international.org/publications/standards/Ecma-335.htm) standard.
27+
The **/WINMD** linker option is used for UWP apps and Windows runtime components to control the creation of a Windows Runtime metadata (.winmd) file. A .winmd file is a kind of DLL that contains metadata for Windows runtime types and, in the case of runtime components, the implementations of those types. The metadata follows the [ECMA-335](https://ecma-international.org/publications-and-standards/standards/ecma-335/) standard.
2828

2929
By default, the output file name has the form *binaryname*.winmd. To specify a different file name, use the [/WINMDFILE](winmdfile-specify-winmd-file.md) option.
3030

docs/c-runtime-library/reference/fstat-fstat32-fstat64-fstati64-fstat32i64-fstat64i32.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ int _fstat(
2222
);
2323
int _fstat32(
2424
int fd,
25-
struct __stat32 *buffer
25+
struct _stat32 *buffer
2626
);
2727
int _fstat64(
2828
int fd,
29-
struct __stat64 *buffer
29+
struct _stat64 *buffer
3030
);
3131
int _fstati64(
3232
int fd,
@@ -73,7 +73,7 @@ If *`fd`* refers to a device, the **`st_atime`**, **`st_ctime`**, **`st_mtime`**
7373

7474
Because `Stat.h` uses the [`_dev_t`](../standard-types.md) type, which is defined in `Types.h`, you must include `Types.h` before `Stat.h` in your code.
7575

76-
**`_fstat64`**, which uses the `__stat64` structure, allows file-creation dates to be expressed up through 23:59:59, December 31, 3000, UTC; whereas the other functions only represent dates through 23:59:59 January 18, 2038, UTC. The lower bound of the date range for all these functions is Midnight, January 1, 1970.
76+
**`_fstat64`**, which uses the `_stat64` structure, allows file-creation dates to be expressed up through 23:59:59, December 31, 3000, UTC; whereas the other functions only represent dates through 23:59:59 January 18, 2038, UTC. The lower bound of the date range for all these functions is Midnight, January 1, 1970.
7777

7878
Variations of these functions support 32-bit or 64-bit time types and 32-bit or 64-bit file lengths. The first numerical suffix (**`32`** or **`64`**) indicates the size of the time type used; the second suffix is either **`i32`** or **`i64`**, indicating whether the file size is represented as a 32-bit or 64-bit integer.
7979

docs/c-runtime-library/reference/gmtime-gmtime32-gmtime64.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "gmtime, _gmtime32, _gmtime64"
33
description: "API reference for gmtime, _gmtime32, and _gmtime64, which convert a time_t value."
4-
ms.date: "10/27/2020"
4+
ms.date: 02/23/2024
55
api_name: ["_gmtime32", "gmtime", "_gmtime64", "_o__gmtime32", "_o__gmtime64"]
66
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-time-l1-1-0.dll"]
77
api_type: ["DLLExport"]
@@ -54,9 +54,6 @@ These functions validate their parameters. If *`sourceTime`* is a `NULL` pointer
5454
5555
The **`_gmtime32`** function breaks down the *`sourceTime`* value and stores it in a statically allocated structure of type `tm`, defined in `TIME.H`. The value of *`sourceTime`* is typically obtained from a call to the [`time`](time-time32-time64.md) function.
5656
57-
> [!NOTE]
58-
> In most cases, the target environment tries to determine whether daylight savings time is in effect. The C run-time library assumes that the United States rules for implementing the calculation of Daylight Saving Time (DST) are used.
59-
6057
By default, this function's global state is scoped to the application. To change this behavior, see [Global state in the CRT](../global-state.md).
6158
6259
## Requirements

docs/c-runtime-library/reference/gmtime-s-gmtime32-s-gmtime64-s.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: gmtime_s, _gmtime32_s, _gmtime64_s"
33
title: "gmtime_s, _gmtime32_s, _gmtime64_s"
4-
ms.date: "4/2/2020"
4+
ms.date: 02/23/2024
55
api_name: ["_gmtime32_s", "gmtime_s", "_gmtime64_s", "_o__gmtime32_s", "_o__gmtime64_s"]
66
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-time-l1-1-0.dll"]
77
api_type: ["DLLExport"]
@@ -56,9 +56,6 @@ The first two error conditions invoke the invalid parameter handler, as describe
5656

5757
The **`_gmtime32_s`** function breaks down the *`sourceTime`* value and stores it in a structure of type `tm`, defined in `Time.h`. The address of the structure is passed in *`tmDest`*. The value of *`sourceTime`* is often obtained from a call to the [`time`](time-time32-time64.md) function.
5858

59-
> [!NOTE]
60-
> The target environment should try to determine whether daylight savings time is in effect. The C run-time library assumes the United States rules for implementing the calculation of daylight saving time .
61-
6259
Each of the structure fields is of type **`int`**, as shown in the following table.
6360

6461
| Field | Description |

docs/c-runtime-library/reference/memcpy-wmemcpy.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["wmemcpy", "memcpy"]
1010
helpviewer_keywords: ["wmemcpy function", "memcpy function"]
11-
ms.assetid: 34abb90b-bffb-46dc-a2f3-a5e9940839d6
1211
---
1312
# `memcpy`, `wmemcpy`
1413

@@ -49,14 +48,14 @@ The value of *`dest`*.
4948
**`memcpy`** copies *`count`* bytes from *`src`* to *`dest`*; **`wmemcpy`** copies *`count`* wide characters. If the source and destination regions overlap, the behavior of **`memcpy`** is undefined. Use **`memmove`** to handle overlapping regions.
5049

5150
> [!IMPORTANT]
52-
> Make sure that the destination buffer is the same size or larger than the source buffer. For more information, see [Avoiding buffer overruns](/windows/win32/SecBP/avoiding-buffer-overruns).
51+
> Make sure that the destination buffer is large enough to accommodate the number of copied characters. For more information, see [Avoiding buffer overruns](/windows/win32/SecBP/avoiding-buffer-overruns).
5352
5453
> [!IMPORTANT]
5554
> Because so many buffer overruns, and thus potential security exploits, have been traced to improper usage of **`memcpy`**, this function is listed among the "banned" functions by the Security Development Lifecycle (SDL). You may observe that some VC++ library classes continue to use **`memcpy`**. Furthermore, you may observe that the VC++ compiler optimizer sometimes emits calls to **`memcpy`**. The Visual C++ product is developed in accordance with the SDL process, and thus usage of this banned function has been closely evaluated. In the case of library use of it, the calls have been carefully scrutinized to ensure that buffer overruns will not be allowed through these calls. In the case of the compiler, sometimes certain code patterns are recognized as identical to the pattern of **`memcpy`**, and are thus replaced with a call to the function. In such cases, the use of **`memcpy`** is no more unsafe than the original instructions would have been; they have simply been optimized to a call to the performance-tuned **`memcpy`** function. Just as the use of "safe" CRT functions doesn't guarantee safety (they just make it harder to be unsafe), the use of "banned" functions doesn't guarantee danger (they just require greater scrutiny to ensure safety).
5655
>
5756
> Because **`memcpy`** usage by the VC++ compiler and libraries has been so carefully scrutinized, these calls are permitted within code that otherwise conforms with the SDL. **`memcpy`** calls introduced in application source code only conform with the SDL when that use has been reviewed by security experts.
5857
59-
The **`memcpy`** and **`wmemcpy`** functions are only deprecated if the constant `_CRT_SECURE_DEPRECATE_MEMORY` is defined before the include statement, as in the example below:
58+
The **`memcpy`** and **`wmemcpy`** functions are only deprecated if the constant `_CRT_SECURE_DEPRECATE_MEMORY` is defined before the `#include` statement, as in the following examples:
6059

6160
```C
6261
#define _CRT_SECURE_DEPRECATE_MEMORY

docs/c-runtime-library/reference/memmove-wmemmove.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ The value of *`dest`*.
4747

4848
Copies *`count`* bytes (**`memmove`**) or characters (**`wmemmove`**) from *`src`* to *`dest`*. If some portions of the source and the destination regions overlap, both functions ensure that the original source bytes in the overlapping region are copied before being overwritten.
4949

50-
**Security Note** Make sure that the destination buffer is the same size or larger than the source buffer. For more information, see [Avoiding buffer overruns](/windows/win32/SecBP/avoiding-buffer-overruns).
50+
**Security Note** Make sure that the destination buffer is large enough to accommodate the number of moved characters. For more information, see [Avoiding buffer overruns](/windows/win32/SecBP/avoiding-buffer-overruns).
5151

52-
The **`memmove`** and **`wmemmove`** functions will only be deprecated if the constant `_CRT_SECURE_DEPRECATE_MEMORY` is defined before the inclusion statement in order for the functions to be deprecated, such as in the example below:
52+
The **`memmove`** and **`wmemmove`** functions are only deprecated if the constant `_CRT_SECURE_DEPRECATE_MEMORY` is defined before the `#include` statement, as shown in the following example:
5353

5454
```C
5555
#define _CRT_SECURE_DEPRECATE_MEMORY

docs/c-runtime-library/reference/toupper-toupper-towupper-toupper-l-towupper-l.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["CTYPE/toupper", "CTYPE/_toupper", "CTYPE/_toupper_l", "CORECRT_WCTYPE/towupper", "CORECRT_WCTYPE/_towupper_l", "TCHAR/_totupper", "TCHAR/_totupper_l", "toupper", "_toupper", "_toupper_l", "towupper", "_towupper_l", "_totupper", "_totupper_l"]
1010
helpviewer_keywords: ["_toupper function", "towupper function", "uppercase, converting strings to", "totupper function", "string conversion, to different characters", "towupper_l function", "toupper_l function", "string conversion, case", "_toupper_l function", "_towupper_l function", "_totupper function", "case, converting", "characters, converting", "toupper function"]
11-
ms.assetid: cdef1b0f-b19c-4d11-b7d2-cf6334c9b6cc
1211
---
1312
# `toupper`, `_toupper`, `towupper`, `_toupper_l`, `_towupper_l`
1413

@@ -52,19 +51,17 @@ If *`c`* is a wide character for which `iswlower` is nonzero and there's a corre
5251

5352
There's no return value reserved to indicate an error.
5453

55-
In order for **`toupper`** to give the expected results, [`__isascii`](isascii-isascii-iswascii.md) and [`islower`](islower-iswlower-islower-l-iswlower-l.md) must both return nonzero.
56-
5754
## Remarks
5855

5956
Each of these routines converts a given lowercase letter to an uppercase letter if possible and appropriate. The case conversion of **`towupper`** is locale-specific. Only the characters relevant to the current locale are changed in case. The functions without the `_l` suffix use the currently set locale. The versions of these functions with the `_l` suffix take the locale as a parameter and use that instead of the currently set locale. For more information, see [Locale](../locale.md).
6057

61-
In order for **`toupper`** to give the expected results, [`__isascii`](isascii-isascii-iswascii.md) and [`isupper`](isupper-isupper-l-iswupper-iswupper-l.md) must both return nonzero.
58+
For **`toupper`** to give the expected results, [`__isascii`](isascii-isascii-iswascii.md) must return nonzero.
6259

6360
By default, this function's global state is scoped to the application. To change this behavior, see [Global state in the CRT](../global-state.md).
6461

6562
### Generic-text routine mappings
6663

67-
| TCHAR.H routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
64+
| `TCHAR.H` routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
6865
|---|---|---|---|
6966
| `_totupper` | **`toupper`** | **`_mbctoupper`** | **`towupper`** |
7067
| `_totupper_l` | **`_toupper_l`** | **`_mbctoupper_l`** | **`_towupper_l`** |

docs/c-runtime-library/rtdynamiccast.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["RTTIDATA/__RTDynamicCast", "__RTDynamicCast"]
1010
helpviewer_keywords: ["__RTDynamicCast"]
11-
ms.assetid: 56aa2d7a-aa47-46ef-830d-e37175611239
1211
---
1312
# `__RTDynamicCast`
1413

@@ -17,13 +16,13 @@ Runtime implementation of the [`dynamic_cast`](../cpp/dynamic-cast-operator.md)
1716
## Syntax
1817

1918
```cpp
20-
PVOID __RTDynamicCast (
19+
PVOID __RTDynamicCast(
2120
PVOID inptr,
2221
LONG VfDelta,
2322
PVOID SrcType,
2423
PVOID TargetType,
2524
BOOL isReference
26-
) throw(...)
25+
) throw(...)
2726
```
2827
2928
#### Parameters
@@ -45,7 +44,7 @@ Intended result of cast.
4544
4645
## Return value
4746
48-
Pointer to the appropriate subobject, if successful; otherwise, `NULL`.
47+
Pointer to the appropriate subobject if successful; otherwise, `NULL`.
4948
5049
## Exceptions
5150
@@ -59,4 +58,4 @@ Converts `inptr` to an object of type `TargetType`. The type of `inptr` must be
5958
6059
| Routine | Required header |
6160
|---|---|
62-
| **`__RTDynamicCast`** | `<rtti.h>` |
61+
| **`__RTDynamicCast`** | `<rttidata.h>` |

docs/code-quality/clang-tidy.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,58 @@ For more information, see [How to: Set Code Analysis Properties for C/C++ Projec
3131

3232
## CMake
3333

34-
In CMake projects, you can configure Clang-Tidy checks within *`CMakeSettings.json`*. Once opened, select "Edit JSON" in the top right-hand corner of the CMake Project Settings Editor. The following keys are recognized:
34+
In CMake projects, you can configure Clang-Tidy checks within *`CMakeSettings.json`* or *`CMakePresets.json`*.
35+
36+
Clang-Tidy recognizes the following keys:
3537

3638
- `enableMicrosoftCodeAnalysis`: Enables Microsoft Code Analysis
3739
- `enableClangTidyCodeAnalysis`: Enables Clang-Tidy analysis
38-
- `clangTidyChecks`: Clang-Tidy configuration, specified as a comma-separated list, that is, checks to be enabled or disabled
40+
- `clangTidyChecks`: Clang-Tidy configuration. A comma-separated list of checks to enable or disable. A leading `-` disables the check. For example, "cert-oop58-cpp, -cppcoreguidelines-no-malloc, google-runtime-int" enables `cert-oop58-cpp` and `google-runtime-int`, but disables `cppcoreguidelines-no-malloc`.
3941

4042
If neither of the "enable" options are specified, Visual Studio will select the analysis tool matching the Platform Toolset used.
4143

44+
### CMake settings
45+
46+
To edit your Clang-Tidy settings, open your CMake settings, and select **Edit JSON** in the CMake Project Settings Editor. You can use the keys above to fill out your Clang-Tidy specifications in the CMake Settings json file.
47+
48+
An example CMake settings implementation looks like this:
49+
50+
```json
51+
{
52+
"configurations": [
53+
{
54+
"name": "x64-debug",
55+
"generator": "Ninja",
56+
....
57+
"clangTidyChecks": "llvm-include-order, -modernize-use-override",
58+
"enableMicrosoftCodeAnalysis": true,
59+
"enableClangTidyCodeAnalysis": true
60+
}
61+
]
62+
}
63+
```
64+
65+
### CMake presets
66+
67+
The same keys can be used in your CMake presets via the `vendor` object.
68+
69+
An example CMake preset implementation looks like this:
70+
71+
```json
72+
"configurePreset": [
73+
{ "name": "base",
74+
....
75+
"vendor": {
76+
"microsoft.com/VisualStudioSettings/CMake/1.0": {
77+
"clangTidyChecks": "llvm-include-order, -modernize-use-override",
78+
"enableMicrosoftCodeAnalysis": true,
79+
"enableClangTidyCodeAnalysis": true
80+
}
81+
}
82+
}
83+
]
84+
```
85+
4286
## Warning display
4387

4488
Clang-Tidy runs result in warnings displayed in the Error List, and as in-editor squiggles underneath relevant sections of code. Use the "Category" column in the Error List to sort and organize Clang-Tidy warnings. You can configure in-editor warnings by toggling the "Disable Code Analysis Squiggles" setting under **Tools** > **Options**.

docs/cpp/additive-operators-plus-and.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ f1_keywords: ["+", "-"]
66
helpviewer_keywords: ["operators [C++], addition", "subtraction operator [C++], additive operators", "+ operator [C++], additive operators", "additive operators [C++]", "arithmetic operators [C++], additive operators", "- operator [C++], additive operators in C++"]
77
ms.assetid: d4afafe7-e201-4c69-a649-37f17756e784
88
---
9-
# Additive Operators: + and -
9+
# Additive Operators: `+` and `-`
1010

1111
## Syntax
1212

@@ -102,6 +102,6 @@ One of the operands can be of integral type, as long as it is the second operand
102102

103103
## See also
104104

105-
[Expressions with Binary Operators](../cpp/expressions-with-binary-operators.md)<br/>
106-
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)<br/>
105+
[Expressions with Binary Operators](../cpp/expressions-with-binary-operators.md)\
106+
[C++ Built-in Operators, Precedence and Associativity](../cpp/cpp-built-in-operators-precedence-and-associativity.md)\
107107
[C Additive Operators](../c-language/c-additive-operators.md)

0 commit comments

Comments
 (0)