tmp/tmphhvecor7/{from.md → to.md}
RENAMED
|
@@ -1,57 +1,70 @@
|
|
| 1 |
### [[input.output]]: input/output library <a id="diff.cpp17.input.output">[[diff.cpp17.input.output]]</a>
|
| 2 |
|
| 3 |
**Change:** Character array extraction only takes array types.
|
| 4 |
**Rationale:** Increase safety via preventing buffer overflow at compile
|
| 5 |
time. **Effect on original feature:** Valid C++17 code may fail to
|
| 6 |
-
compile in this revision of C++.
|
|
|
|
|
|
|
| 7 |
|
| 8 |
``` cpp
|
| 9 |
auto p = new char[100];
|
| 10 |
char q[100];
|
| 11 |
std::cin >> std::setw(20) >> p; // ill-formed; previously well-formed
|
| 12 |
std::cin >> std::setw(20) >> q; // OK
|
| 13 |
```
|
| 14 |
|
|
|
|
|
|
|
| 15 |
**Change:** Overload resolution for ostream inserters used with UTF-8
|
| 16 |
literals. **Rationale:** Required for new features. **Effect on original
|
| 17 |
feature:** Valid C++17 code that passes UTF-8 literals to
|
| 18 |
`basic_ostream<char, ...>::operator<<` or
|
| 19 |
-
`basic_ostream<wchar_t, ...>::operator<<` is now ill-formed.
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
``` cpp
|
| 23 |
std::cout << u8"text"; // previously called operator<<(const char*) and printed a string;
|
| 24 |
// now ill-formed
|
| 25 |
std::cout << u8'X'; // previously called operator<<(char) and printed a character;
|
| 26 |
// now ill-formed
|
| 27 |
```
|
| 28 |
|
|
|
|
|
|
|
| 29 |
**Change:** Overload resolution for ostream inserters used with
|
| 30 |
`wchar_t`, `char16_t`, or `char32_t` types. **Rationale:** Removal of
|
| 31 |
surprising behavior. **Effect on original feature:** Valid C++17 code
|
| 32 |
that passes `wchar_t`, `char16_t`, or `char32_t` characters or strings
|
| 33 |
to `basic_ostream<char, ...>::operator<<` or that passes `char16_t` or
|
| 34 |
`char32_t` characters or strings to
|
| 35 |
-
`basic_ostream<wchar_t, ...>::operator<<` is now ill-formed.
|
| 36 |
-
|
|
|
|
| 37 |
|
| 38 |
``` cpp
|
| 39 |
std::cout << u"text"; // previously formatted the string as a pointer value;
|
| 40 |
// now ill-formed
|
| 41 |
std::cout << u'X'; // previously formatted the character as an integer value;
|
| 42 |
// now ill-formed
|
| 43 |
```
|
| 44 |
|
|
|
|
|
|
|
| 45 |
**Change:** Return type of filesystem path format observer member
|
| 46 |
functions. **Rationale:** Required for new features. **Effect on
|
| 47 |
original feature:** Valid C++17 code that depends on the `u8string()`
|
| 48 |
and `generic_u8string()` member functions of `std::filesystem::path`
|
| 49 |
-
returning `std::string` is not valid in this revision of C++.
|
| 50 |
-
|
|
|
|
| 51 |
|
| 52 |
``` cpp
|
| 53 |
std::filesystem::path p;
|
| 54 |
std::string s1 = p.u8string(); // ill-formed; previously well-formed
|
| 55 |
std::string s2 = p.generic_u8string(); // ill-formed; previously well-formed
|
| 56 |
```
|
| 57 |
|
|
|
|
|
|
|
|
|
| 1 |
### [[input.output]]: input/output library <a id="diff.cpp17.input.output">[[diff.cpp17.input.output]]</a>
|
| 2 |
|
| 3 |
**Change:** Character array extraction only takes array types.
|
| 4 |
**Rationale:** Increase safety via preventing buffer overflow at compile
|
| 5 |
time. **Effect on original feature:** Valid C++17 code may fail to
|
| 6 |
+
compile in this revision of C++.
|
| 7 |
+
|
| 8 |
+
[*Example 1*:
|
| 9 |
|
| 10 |
``` cpp
|
| 11 |
auto p = new char[100];
|
| 12 |
char q[100];
|
| 13 |
std::cin >> std::setw(20) >> p; // ill-formed; previously well-formed
|
| 14 |
std::cin >> std::setw(20) >> q; // OK
|
| 15 |
```
|
| 16 |
|
| 17 |
+
— *end example*]
|
| 18 |
+
|
| 19 |
**Change:** Overload resolution for ostream inserters used with UTF-8
|
| 20 |
literals. **Rationale:** Required for new features. **Effect on original
|
| 21 |
feature:** Valid C++17 code that passes UTF-8 literals to
|
| 22 |
`basic_ostream<char, ...>::operator<<` or
|
| 23 |
+
`basic_ostream<wchar_t, ...>::operator<<` is now ill-formed.
|
| 24 |
+
|
| 25 |
+
[*Example 2*:
|
| 26 |
|
| 27 |
``` cpp
|
| 28 |
std::cout << u8"text"; // previously called operator<<(const char*) and printed a string;
|
| 29 |
// now ill-formed
|
| 30 |
std::cout << u8'X'; // previously called operator<<(char) and printed a character;
|
| 31 |
// now ill-formed
|
| 32 |
```
|
| 33 |
|
| 34 |
+
— *end example*]
|
| 35 |
+
|
| 36 |
**Change:** Overload resolution for ostream inserters used with
|
| 37 |
`wchar_t`, `char16_t`, or `char32_t` types. **Rationale:** Removal of
|
| 38 |
surprising behavior. **Effect on original feature:** Valid C++17 code
|
| 39 |
that passes `wchar_t`, `char16_t`, or `char32_t` characters or strings
|
| 40 |
to `basic_ostream<char, ...>::operator<<` or that passes `char16_t` or
|
| 41 |
`char32_t` characters or strings to
|
| 42 |
+
`basic_ostream<wchar_t, ...>::operator<<` is now ill-formed.
|
| 43 |
+
|
| 44 |
+
[*Example 3*:
|
| 45 |
|
| 46 |
``` cpp
|
| 47 |
std::cout << u"text"; // previously formatted the string as a pointer value;
|
| 48 |
// now ill-formed
|
| 49 |
std::cout << u'X'; // previously formatted the character as an integer value;
|
| 50 |
// now ill-formed
|
| 51 |
```
|
| 52 |
|
| 53 |
+
— *end example*]
|
| 54 |
+
|
| 55 |
**Change:** Return type of filesystem path format observer member
|
| 56 |
functions. **Rationale:** Required for new features. **Effect on
|
| 57 |
original feature:** Valid C++17 code that depends on the `u8string()`
|
| 58 |
and `generic_u8string()` member functions of `std::filesystem::path`
|
| 59 |
+
returning `std::string` is not valid in this revision of C++.
|
| 60 |
+
|
| 61 |
+
[*Example 4*:
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
std::filesystem::path p;
|
| 65 |
std::string s1 = p.u8string(); // ill-formed; previously well-formed
|
| 66 |
std::string s2 = p.generic_u8string(); // ill-formed; previously well-formed
|
| 67 |
```
|
| 68 |
|
| 69 |
+
— *end example*]
|
| 70 |
+
|