Skip to content

Commit a6add0f

Browse files
committed
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs-pr (branch live)
2 parents 3dc8003 + 751dfaa commit a6add0f

27 files changed

+979
-125
lines changed

docs/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ A basic conversion specification contains only the percent sign and a *type* cha
3333

3434
The *type* conversion specifier character specifies whether to interpret the corresponding argument as a character, a string, a pointer, an integer, or a floating-point number. The *type* character is the only required conversion specification field, and it appears after any optional fields.
3535

36-
The arguments that follow the format string are interpreted according to the corresponding *type* character and the optional [*size*](#size) prefix. Conversions for character types `char` and `wchar_t` are specified by using **`c`** or **`C`**, and single-byte and multi-byte or wide character strings are specified by using **`s`** or **`S`**, depending on which formatting function is being used. Character and string arguments that are specified by using **`c`** and **`s`** are interpreted as `char` and `char*` by `printf` family functions, or as `wchar_t` and `wchar_t*` by `wprintf` family functions. Character and string arguments that are specified by using **`C`** and **`S`** are interpreted as `wchar_t` and `wchar_t*` by `printf` family functions, or as `char` and `char*` by `wprintf` family functions. This behavior is Microsoft-specific.
36+
The arguments that follow the format string are interpreted according to the corresponding *type* character and the optional [*size*](#size) prefix. Conversions for character types `char` and `wchar_t` are specified by using **`c`** or **`C`**, and single-byte and multi-byte or wide character strings are specified by using **`s`** or **`S`**, depending on which formatting function is being used. Character and string arguments that are specified by using **`c`** and **`s`** are interpreted as `char` and `char*` by `printf` family functions, or as `wchar_t` and `wchar_t*` by `wprintf` family functions. Character and string arguments that are specified by using **`C`** and **`S`** are interpreted as `wchar_t` and `wchar_t*` by `printf` family functions, or as `char` and `char*` by `wprintf` family functions. This behavior is Microsoft-specific. For historical reasons, the `wprintf` functions use **`c`** and **`s`** to refer to `wchar_t` characters, and **`C`** and **`S`** specify narrow characters.
3737

3838
Integer types such as `short`, `int`, `long`, `long long`, and their `unsigned` variants, are specified by using **`d`**, **`i`**, **`o`**, **`u`**, **`x`**, and **`X`**. Floating-point types such as `float`, `double`, and `long double`, are specified by using **`a`**, **`A`**, **`e`**, **`E`**, **`f`**, **`F`**, **`g`**, and **`G`**. By default, unless they're modified by a *size* prefix, integer arguments are coerced to `int` type, and floating-point arguments are coerced to `double`. On 64-bit systems, an `int` is a 32-bit value; so, 64-bit integers will be truncated when they're formatted for output unless a *size* prefix of **`ll`** or **`I64`** is used. Pointer types that are specified by **`p`** use the default pointer size for the platform.
3939

docs/c-runtime-library/reference/asctime-wasctime.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: asctime, _wasctime"
33
title: "asctime, _wasctime"
4-
ms.date: "4/2/2020"
4+
ms.date: 12/21/2022
55
api_name: ["_wasctime", "asctime", "_o__wasctime", "_o_asctime"]
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"]
@@ -52,32 +52,32 @@ The **`asctime`** function converts a time stored as a structure to a character
5252
| `tm_yday` | Day of year (0-365; January 1 = 0) |
5353
| `tm_year` | Year (current year minus 1900) |
5454

55-
The converted character string is also adjusted according to the local time zone settings. For information about configuring the local time, see the [`time`](time-time32-time64.md), [`_ftime`](ftime-ftime32-ftime64.md), and [`localtime`](localtime-localtime32-localtime64.md) functions. For information about defining the time zone environment and global variables, see the [`_tzset`](tzset.md) function.
55+
For information about configuring the local time, see the [`time`](time-time32-time64.md), [`_ftime`](ftime-ftime32-ftime64.md), and [`localtime`](localtime-localtime32-localtime64.md) functions. For information about defining the time zone environment and global variables, see the [`_tzset`](tzset.md) function.
5656

5757
The string result produced by **`asctime`** contains exactly 26 characters and has the form `Wed Jan 2 02:03:55 1980\n\0`. A 24-hour clock is used. All fields have a constant width. The newline character and the null character occupy the last two positions of the string. **`asctime`** uses a single, statically allocated buffer to hold the return string. Each call to this function destroys the result of the previous call.
5858

59-
**`_wasctime`** is a wide-character version of **`asctime`**. **`_wasctime`** and **`asctime`** behave identically otherwise.
59+
**`_wasctime`** is a wide-character version of **`asctime`**, and otherwise behaves identically to **`asctime`**.
6060

6161
These functions validate their parameters. If *`timeptr`* is a null pointer, or if it contains out-of-range values, the invalid parameter handler is invoked, as described in [Parameter validation](../parameter-validation.md). If execution is allowed to continue, the function returns `NULL` and sets `errno` to `EINVAL`.
6262

6363
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).
6464

6565
### Generic-text routine mapping
6666

67-
| TCHAR.H routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
67+
| `TCHAR.H` routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
6868
|---|---|---|---|
6969
| `_tasctime` | **`asctime`** | **`asctime`** | **`_wasctime`** |
7070

7171
## Requirements
7272

7373
| Routine | Required header |
7474
|---|---|
75-
| **`asctime`** | \<time.h> |
76-
| **`_wasctime`** | \<time.h> or \<wchar.h> |
75+
| **`asctime`** | `<time.h>` |
76+
| **`_wasctime`** | `<time.h>` or `<wchar.h>` |
7777

7878
## Example
7979

80-
This program places the system time in the long integer `aclock`, translates it into the structure `newtime` and then converts it to string form for output, using the **`asctime`** function.
80+
This program places the system time in the long integer `aclock`, translates it into the structure `newtime`, and then converts it to string form for output using the **`asctime`** function.
8181

8282
```C
8383
// crt_asctime.c

docs/c-runtime-library/reference/fopen-wfopen.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["STDIO/fopen", "CORECRT_WSTDIO/_wfopen", "TCHAR/_tfopen", "fopen", "_wfopen", "_tfopen"]
1010
helpviewer_keywords: ["opening files, for file I/O", "wfopen function", "tfopen function", "_tfopen function", "_wfopen function", "files [C++], opening", "fopen function"]
11-
ms.assetid: e868993f-738c-4920-b5e4-d8f2f41f933d
1211
---
1312
# `fopen`, `_wfopen`
1413

@@ -70,7 +69,7 @@ The following table summarizes the modes that are used for various **`ccs`** fla
7069

7170
### Encodings used based on ccs flag and BOM
7271

73-
| ccs flag | No BOM (or new file) | BOM: UTF-8 | BOM: UTF-16 |
72+
| `ccs` flag | No BOM (or new file) | BOM: UTF-8 | BOM: UTF-16 |
7473
|--|--|--|--|
7574
| `UNICODE` | **`UTF-16LE`** | **`UTF-8`** | **`UTF-16LE`** |
7675
| **`UTF-8`** | **`UTF-8`** | **`UTF-8`** | **`UTF-16LE`** |
@@ -82,7 +81,7 @@ If *`mode`* is **`a, ccs=encoding`** for some `encoding` value, **`fopen`** firs
8281

8382
### Generic-text routine mappings
8483

85-
| TCHAR.H routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
84+
| `TCHAR.H` routine | `_UNICODE` and `_MBCS` not defined | `_MBCS` defined | `_UNICODE` defined |
8685
|--|--|--|--|
8786
| **`_tfopen`** | **`fopen`** | **`fopen`** | **`_wfopen`** |
8887

@@ -130,7 +129,7 @@ The following options can be appended to *`mode`* to specify more behaviors.
130129
| **`R`** | Specifies that caching is optimized for, but not restricted to, random access from disk. |
131130
| **`T`** | Specifies a file as temporary. If possible, it isn't flushed to disk. |
132131
| **`D`** | Specifies a file as temporary. It's deleted when the last file pointer is closed. |
133-
| **`ccs=encoding`** | Specifies the encoded character set to use (one of **`UTF-8`**, **`UTF-16LE`**, or `UNICODE`) for this file. Leave unspecified if you want ANSI encoding. |
132+
| **`ccs=encoding`** | Specifies the encoded character set to use (one of **`UTF-8`**, **`UTF-16LE`**, or `UNICODE`) for this file. Leave unspecified if you want ANSI encoding. This flag is separated from flags that precede it by a comma (`,`). For example: `FILE *f = fopen("newfile.txt", "rt+, ccs=UTF-8");` |
134133

135134
Valid characters for the *`mode`* string that is used in **`fopen`** and **`_fdopen`** correspond to *`oflag`* arguments that are used in [`_open`](open-wopen.md) and [`_sopen`](sopen-wsopen.md), as follows.
136135

docs/overview/cpp-conformance-improvements-2019.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,16 @@ To avoid the errors, insert a space in the offending line before the final angle
6666

6767
### References to types with mismatched cv-qualifiers
6868

69-
Previously, MSVC allowed direct binding of a reference from a type with mismatched cv-qualifiers below the top level. This binding could allow modification of supposedly const data referred to by the reference. The compiler now creates a temporary, as required by the standard. In Visual Studio 2017, the following code compiles without warnings. In Visual Studio 2019, the compiler raises warning C4172:
69+
>[!Note]
70+
> This change only affects Visual Studio 2019 versions 16.0 through 16.8. It was reverted starting in Visual Studio 2019 version 16.9
71+
72+
Previously, MSVC allowed direct binding of a reference from a type with mismatched cv-qualifiers below the top level. This binding could allow modification of supposedly const data referred to by the reference.
73+
74+
The compiler for Visual Studio 2019 versions 16.0 through 16.8 instead creates a temporary, as was required by the standard at that time. Later, the standard retroactively changed making the previous behavior of Visual Studio 2017 and earlier correct, and the behavior of Visual Studio 2019 version 16.0 through 16.8 wrong. Consequently, this change was reverted starting in Visual Studio 2019 version 16.9.
75+
76+
See [Similar types and reference binding](#similar-types-and-reference-binding) for a related change.
77+
78+
As an example, in Visual Studio 2017, the following code compiles without warnings. In Visual Studio 2019 versions 16.0 through 16.8, the compiler raises warning C4172. Starting with Visual Studio 2019 version 16.9, the code once again compiles without warnings:
7079

7180
```cpp
7281
struct X
@@ -2067,10 +2076,14 @@ With this change, a destructor is also potentially throwing if it has a virtual
20672076

20682077
### Similar types and reference binding
20692078

2070-
Core Working Group issue [CWG 2352](https://wg21.link/cwg2352) deals with an inconsistency between the reference binding rules and changes to type similarity. The inconsistency was introduced in earlier Defect Reports (such as [CWG 330](https://wg21.link/cwg330)). With this change, code that previously bound a reference to a temporary may now bind directly when the types involved differ only by cv-qualifiers.
2079+
Core Working Group issue [CWG 2352](https://wg21.link/cwg2352) deals with an inconsistency between the reference binding rules and changes to type similarity. The inconsistency was introduced in earlier Defect Reports (such as [CWG 330](https://wg21.link/cwg330)). This affected Visual Studio 2019 versions 16.0 through 16.8.
2080+
2081+
With this change, starting in Visual Studio 2019 version 16.9, code that previously bound a reference to a temporary in Visual Studio 2019 version 16.0 throught 16.8 may now bind directly when the types involved differ only by cv-qualifiers.
20712082

20722083
Visual Studio 2019 version 16.9 implements the changed behavior in all **`/std`** compiler modes. It's potentially a source breaking change.
20732084

2085+
See [References to types with mismatched cv-qualifiers](#references-to-types-with-mismatched-cv-qualifiers) for a related change.
2086+
20742087
This sample shows the changed behavior:
20752088

20762089
```cpp

docs/standard-library/common-view-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ For a description of the following entries, see [View class characteristics](vie
3232
| **Range adaptor** | [`views::common`](range-adaptors.md#common) |
3333
| **Underlying range** | Must satisfy [`forward_range`](range-concepts.md#forward_range) or higher |
3434
| **Element type** | Same as the underlying range |
35-
| **View iterator category** | Supports `forward_range` or [`random_access_range`](range-concepts.md#random_access_range) when the underlying range satisfies `random_access_range` and [`sized_range`](range-concepts.md#sized_range) |
35+
| **View iterator category** | `forward_range` or [`random_access_range`](range-concepts.md#random_access_range) when the underlying range satisfies `random_access_range` and [`sized_range`](range-concepts.md#sized_range) |
3636
| **Sized** | Only if the underlying range satisfies [`sized_range`](range-concepts.md#sized_range) |
3737
| **Is `const`-iterable** | Only if the underlying range is `const` iterable |
3838
| **Common range** | Yes |

docs/standard-library/drop-while-view-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ For a description of the following entries, see [View class characteristics](vie
3636
| Characteristic | Description |
3737
|--|--|
3838
| **Range adaptor** | [`views::drop_while`](range-adaptors.md#drop_while) |
39-
| **Underlying range** | Must satisfy [`forward_range`](range-concepts.md#forward_range) or higher and the underlying range's iterators must model `sized_sentinel_for` |
39+
| **Underlying range** | Must satisfy [`forward_range`](range-concepts.md#forward_range) or higher and the underlying range's iterators must model [`sized_sentinel_for`](iterator-concepts.md#sized_sentinel_for) |
4040
| **Element type** | Same as the underlying range |
4141
| **View iterator category** | Same as the underlying range |
4242
| **Sized** | Only if the underlying range satisfies [`random_access_range`](range-concepts.md#random_access_range) |

docs/standard-library/empty-view-class.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ For a description of the following entries, see [View class characteristics](vie
3232
| **Range adaptor** | [`views::empty`](range-adaptors.md#empty) |
3333
| **Underlying range** | None |
3434
| **Element type** | As specified when the `empty_view` is created |
35-
| **View iterator category** | Supports `contiguous_range` |
35+
| **View iterator category** | `contiguous_range` |
3636
| **Sized** | Yes. Always returns 0 |
3737
| **Is `const`-iterable** | Yes |
3838
| **Common range** | Yes |
@@ -82,7 +82,7 @@ inline constexpr empty_view<T> empty{};
8282
### Parameters
8383

8484
*`T`*\
85-
The type of the underlying element, of which there are none.
85+
The type of the underlying element, of which there is none.
8686

8787
### Remarks
8888

docs/standard-library/filter-view-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For a description of the following entries, see [View class characteristics](vie
3535
| **Range adaptor** | [`views::filter`](range-adaptors.md#filter) |
3636
| **Underlying range** | Must satisfy [`input_range`](range-concepts.md#input_range) or higher |
3737
| **Element type** | Same as the underlying range |
38-
| **View iterator category** | Supports `input_range`, [`forward_range`](range-concepts.md#forward_range), or [`bidirectional_range`](range-concepts.md#bidirectional_range) depending on the underlying range |
38+
| **View iterator category** | `input_range`, [`forward_range`](range-concepts.md#forward_range), or [`bidirectional_range`](range-concepts.md#bidirectional_range) depending on the underlying range |
3939
| **Sized** | No |
4040
| **Is `const`-iterable** | No |
4141
| **Common range** | Only if the underlying range satisfies [`common_range`](range-concepts.md#common_range) |

0 commit comments

Comments
 (0)