From Jason Turner

[diff.cpp17.input.output]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpcv43we35/{from.md → to.md} +54 -0
tmp/tmpcv43we35/{from.md → to.md} RENAMED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 International Standard:
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
+ ``` cpp
22
+ std::cout << u8"text"; // previously called operator<<(const char*) and printed a string;
23
+ // now ill-formed
24
+ std::cout << u8'X'; // previously called operator<<(char) and printed a character;
25
+ // now ill-formed
26
+ ```
27
+
28
+ **Change:** Overload resolution for ostream inserters used with
29
+ `wchar_t`, `char16_t`, or `char32_t` types. **Rationale:** Removal of
30
+ surprising behavior. **Effect on original feature:** Valid C++17 code
31
+ that passes `wchar_t`, `char16_t`, or `char32_t` characters or strings
32
+ to `basic_ostream<char, ...>::operator<<` or that passes `char16_t` or
33
+ `char32_t` characters or strings to
34
+ `basic_ostream<wchar_t, ...>::operator<<` is now ill-formed.
35
+
36
+ ``` cpp
37
+ std::cout << u"text"; // previously formatted the string as a pointer value;
38
+ // now ill-formed
39
+ std::cout << u'X'; // previously formatted the character as an integer value;
40
+ // now ill-formed
41
+ ```
42
+
43
+ **Change:** Return type of filesystem path format observer member
44
+ functions. **Rationale:** Required for new features. **Effect on
45
+ original feature:** Valid C++17 code that depends on the `u8string()`
46
+ and `generic_u8string()` member functions of `std::filesystem::path`
47
+ returning `std::string` is not valid in this International Standard.
48
+
49
+ ``` cpp
50
+ std::filesystem::path p;
51
+ std::string s1 = p.u8string(); // ill-formed; previously well-formed
52
+ std::string s2 = p.generic_u8string(); // ill-formed; previously well-formed
53
+ ```
54
+