From Jason Turner

[diff.cpp17.input.output]

Diff to HTML by rtfpessoa

tmp/tmpx1ivpbjh/{from.md → to.md} RENAMED
@@ -1,11 +1,11 @@
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
@@ -14,11 +14,12 @@ std::cin >> std::setw(20) >> q; // OK
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;
@@ -29,11 +30,12 @@ std::cout << u8'X'; // previously called operator<<(char) and printe
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;
@@ -42,11 +44,12 @@ std::cout << u'X'; // previously formatted the character as an inte
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
 
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++. For example:
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
 
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. For
20
+ example:
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;
 
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. For
36
+ example:
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;
 
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++. For
50
+ example:
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