From Jason Turner

[diff.cpp11]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpp8xt9e1k/{from.md → to.md} +23 -9
tmp/tmpp8xt9e1k/{from.md → to.md} RENAMED
@@ -1,31 +1,35 @@
1
  ## C++ and ISO C++11 <a id="diff.cpp11">[[diff.cpp11]]</a>
2
 
3
  ### General <a id="diff.cpp11.general">[[diff.cpp11.general]]</a>
4
 
5
- Subclause [[diff.cpp11]] lists the differences between C++ and ISO C++11
6
- (ISO/IEC 14882:2011, *Programming Languages — C++*), in addition to
7
- those listed above, by the chapters of this document.
8
 
9
  ### [[lex]]: lexical conventions <a id="diff.cpp11.lex">[[diff.cpp11.lex]]</a>
10
 
11
  **Change:** *pp-number* can contain one or more single quotes.
12
  **Rationale:** Necessary to enable single quotes as digit separators.
13
  **Effect on original feature:** Valid C++11 code may fail to compile or
14
  may change meaning in this revision of C++. For example, the following
15
  code is valid both in C++11 and in this revision of C++, but the macro
16
  invocation produces different outcomes because the single quotes delimit
17
  a *character-literal* in C++11, whereas they are digit separators in
18
- this revision of C++. For example:
 
 
19
 
20
  ``` cpp
21
  #define M(x, ...) __VA_ARGS__
22
  int x[2] = { M(1'2,3'4, 5) };
23
  // int x[2] = { 5 \ \ \ \ \ } --- C++11{}
24
  // int x[2] = { 3'4, 5 } --- this revision of C++{}
25
  ```
26
 
 
 
27
  ### [[basic]]: basics <a id="diff.cpp11.basic">[[diff.cpp11.basic]]</a>
28
 
29
  **Change:** New usual (non-placement) deallocator. **Rationale:**
30
  Required for sized deallocation. **Effect on original feature:** Valid
31
  C++11 code can declare a global placement allocation function and
@@ -50,11 +54,13 @@ operand. **Rationale:** Formerly mandated conversions (lvalue-to-rvalue
50
  [[conv.lval]], array-to-pointer [[conv.array]], and function-to-pointer
51
  [[conv.func]] standard conversions), especially the creation of the
52
  temporary due to lvalue-to-rvalue conversion, were considered gratuitous
53
  and surprising. **Effect on original feature:** Valid C++11 code that
54
  relies on the conversions may behave differently in this revision of
55
- C++. For example:
 
 
56
 
57
  ``` cpp
58
  struct S {
59
  int x = 1;
60
  void mf() { x = 2; }
@@ -74,17 +80,20 @@ sizeof(true ? "" : throw 0)
74
  ```
75
 
76
  In C++11, the expression yields `sizeof(const char*)`. In this revision
77
  of C++, it yields `sizeof(const char[1])`.
78
 
79
- ### [[dcl.dcl]]: declarations <a id="diff.cpp11.dcl.dcl">[[diff.cpp11.dcl.dcl]]</a>
 
 
80
 
81
  **Change:** `constexpr` non-static member functions are not implicitly
82
  `const` member functions. **Rationale:** Necessary to allow `constexpr`
83
  member functions to mutate the object. **Effect on original feature:**
84
- Valid C++11 code may fail to compile in this revision of C++. For
85
- example:
 
86
 
87
  ``` cpp
88
  struct S {
89
  constexpr const int &f();
90
  int &f();
@@ -92,15 +101,18 @@ struct S {
92
  ```
93
 
94
  This code is valid in C++11 but invalid in this revision of C++ because
95
  it declares the same member function twice with different return types.
96
 
 
 
97
  **Change:** Classes with default member initializers can be aggregates.
98
  **Rationale:** Necessary to allow default member initializers to be used
99
  by aggregate initialization. **Effect on original feature:** Valid C++11
100
  code may fail to compile or may change meaning in this revision of C++.
101
- For example:
 
102
 
103
  ``` cpp
104
  struct S { // Aggregate in C++14{} onwards.
105
  int m = 1;
106
  };
@@ -111,10 +123,12 @@ struct X {
111
  X a{};
112
  S b{a}; // uses copy constructor in C++11{},
113
  // performs aggregate initialization in this revision of C++{}
114
  ```
115
 
 
 
116
  ### [[library]]: library introduction <a id="diff.cpp11.library">[[diff.cpp11.library]]</a>
117
 
118
  **Change:** New header. **Rationale:** New functionality. **Effect on
119
  original feature:** The C++ header `<shared_mutex>` is new. Valid C++11
120
  code that `#include`s a header with that name may be invalid in this
 
1
  ## C++ and ISO C++11 <a id="diff.cpp11">[[diff.cpp11]]</a>
2
 
3
  ### General <a id="diff.cpp11.general">[[diff.cpp11.general]]</a>
4
 
5
+ Subclause [[diff.cpp11]] lists the differences between C++ and ISO
6
+ C++11, in addition to those listed above, by the chapters of this
7
+ document.
8
 
9
  ### [[lex]]: lexical conventions <a id="diff.cpp11.lex">[[diff.cpp11.lex]]</a>
10
 
11
  **Change:** *pp-number* can contain one or more single quotes.
12
  **Rationale:** Necessary to enable single quotes as digit separators.
13
  **Effect on original feature:** Valid C++11 code may fail to compile or
14
  may change meaning in this revision of C++. For example, the following
15
  code is valid both in C++11 and in this revision of C++, but the macro
16
  invocation produces different outcomes because the single quotes delimit
17
  a *character-literal* in C++11, whereas they are digit separators in
18
+ this revision of C++.
19
+
20
+ [*Example 1*:
21
 
22
  ``` cpp
23
  #define M(x, ...) __VA_ARGS__
24
  int x[2] = { M(1'2,3'4, 5) };
25
  // int x[2] = { 5 \ \ \ \ \ } --- C++11{}
26
  // int x[2] = { 3'4, 5 } --- this revision of C++{}
27
  ```
28
 
29
+ — *end example*]
30
+
31
  ### [[basic]]: basics <a id="diff.cpp11.basic">[[diff.cpp11.basic]]</a>
32
 
33
  **Change:** New usual (non-placement) deallocator. **Rationale:**
34
  Required for sized deallocation. **Effect on original feature:** Valid
35
  C++11 code can declare a global placement allocation function and
 
54
  [[conv.lval]], array-to-pointer [[conv.array]], and function-to-pointer
55
  [[conv.func]] standard conversions), especially the creation of the
56
  temporary due to lvalue-to-rvalue conversion, were considered gratuitous
57
  and surprising. **Effect on original feature:** Valid C++11 code that
58
  relies on the conversions may behave differently in this revision of
59
+ C++.
60
+
61
+ [*Example 1*:
62
 
63
  ``` cpp
64
  struct S {
65
  int x = 1;
66
  void mf() { x = 2; }
 
80
  ```
81
 
82
  In C++11, the expression yields `sizeof(const char*)`. In this revision
83
  of C++, it yields `sizeof(const char[1])`.
84
 
85
+ *end example*]
86
+
87
+ ### [[dcl]]: declarations <a id="diff.cpp11.dcl.dcl">[[diff.cpp11.dcl.dcl]]</a>
88
 
89
  **Change:** `constexpr` non-static member functions are not implicitly
90
  `const` member functions. **Rationale:** Necessary to allow `constexpr`
91
  member functions to mutate the object. **Effect on original feature:**
92
+ Valid C++11 code may fail to compile in this revision of C++.
93
+
94
+ [*Example 1*:
95
 
96
  ``` cpp
97
  struct S {
98
  constexpr const int &f();
99
  int &f();
 
101
  ```
102
 
103
  This code is valid in C++11 but invalid in this revision of C++ because
104
  it declares the same member function twice with different return types.
105
 
106
+ — *end example*]
107
+
108
  **Change:** Classes with default member initializers can be aggregates.
109
  **Rationale:** Necessary to allow default member initializers to be used
110
  by aggregate initialization. **Effect on original feature:** Valid C++11
111
  code may fail to compile or may change meaning in this revision of C++.
112
+
113
+ [*Example 2*:
114
 
115
  ``` cpp
116
  struct S { // Aggregate in C++14{} onwards.
117
  int m = 1;
118
  };
 
123
  X a{};
124
  S b{a}; // uses copy constructor in C++11{},
125
  // performs aggregate initialization in this revision of C++{}
126
  ```
127
 
128
+ — *end example*]
129
+
130
  ### [[library]]: library introduction <a id="diff.cpp11.library">[[diff.cpp11.library]]</a>
131
 
132
  **Change:** New header. **Rationale:** New functionality. **Effect on
133
  original feature:** The C++ header `<shared_mutex>` is new. Valid C++11
134
  code that `#include`s a header with that name may be invalid in this