From Jason Turner

[diff.cpp03]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpy8e_sgm4/{from.md → to.md} +64 -58
tmp/tmpy8e_sgm4/{from.md → to.md} RENAMED
@@ -4,11 +4,11 @@ This subclause lists the differences between C++and ISO C++03(ISO/IEC
4
  14882:2003, *Programming Languages — C++*), by the chapters of this
5
  document.
6
 
7
  ### Clause [[lex]]: lexical conventions <a id="diff.cpp03.lex">[[diff.cpp03.lex]]</a>
8
 
9
- [[lex.pptoken]] **Change:** New kinds of string literals **Rationale:**
10
  Required for new features. **Effect on original feature:** Valid
11
  C++03code may fail to compile or produce different results in this
12
  International Standard. Specifically, macros named `R`, `u8`, `u8R`,
13
  `u`, `uR`, `U`, `UR`, or `LR` will not be expanded when adjacent to a
14
  string literal but will be interpreted as part of the string literal.
@@ -17,11 +17,11 @@ For example,
17
  ``` cpp
18
  #define u8 "abc"
19
  const char* s = u8"def"; // Previously "abcdef", now "def"
20
  ```
21
 
22
- [[lex.pptoken]] **Change:** User-defined literal string support
23
  **Rationale:** Required for new features. **Effect on original
24
  feature:** Valid C++03code may fail to compile or produce different
25
  results in this International Standard, as the following example
26
  illustrates.
27
 
@@ -30,32 +30,32 @@ illustrates.
30
  "hello"_x // #1
31
  ```
32
 
33
  Previously, \#1 would have consisted of two separate preprocessing
34
  tokens and the macro `_x` would have been expanded. In this
35
- International Standard, \#1 consists of a single preprocessing tokens,
36
- so the macro is not expanded.
37
 
38
- [[lex.key]] **Change:** New keywords **Rationale:** Required for new
39
  features. **Effect on original feature:** Added to Table 
40
  [[tab:keywords]], the following identifiers are new keywords: `alignas`,
41
  `alignof`, `char16_t`, `char32_t`, `constexpr`, `decltype`, `noexcept`,
42
  `nullptr`, `static_assert`, and `thread_local`. Valid C++03code using
43
  these identifiers is invalid in this International Standard.
44
 
45
- [[lex.icon]] **Change:** Type of integer literals **Rationale:** C99
46
  compatibility. **Effect on original feature:** Certain integer literals
47
  larger than can be represented by `long` could change from an unsigned
48
  integer type to `signed long long`.
49
 
50
  ### Clause  [[conv]]: standard conversions <a id="diff.cpp03.conv">[[diff.cpp03.conv]]</a>
51
 
52
  [[conv.ptr]] **Change:** Only literals are integer null pointer
53
- constants **Rationale:** Removing surprising interactions with templates
54
- and constant expressions **Effect on original feature:** Valid C++03code
55
- may fail to compile or produce different results in this International
56
- Standard, as the following example illustrates:
57
 
58
  ``` cpp
59
  void f(void *); // #1
60
  void f(...); // #2
61
  template<int N> void g() {
@@ -64,28 +64,40 @@ template<int N> void g() {
64
  ```
65
 
66
  ### Clause [[expr]]: expressions <a id="diff.cpp03.expr">[[diff.cpp03.expr]]</a>
67
 
68
  [[expr.mul]] **Change:** Specify rounding for results of integer `/` and
69
- `%` **Rationale:** Increase portability, C99 compatibility. **Effect on
70
  original feature:** Valid C++03code that uses integer division rounds
71
  the result toward 0 or toward negative infinity, whereas this
72
  International Standard always rounds the result toward 0.
73
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  ### Clause [[dcl.dcl]]: declarations <a id="diff.cpp03.dcl.dcl">[[diff.cpp03.dcl.dcl]]</a>
75
 
76
- [[dcl.spec]] **Change:** Remove `auto` as a storage class specifier
77
  **Rationale:** New feature. **Effect on original feature:** Valid
78
  C++03code that uses the keyword `auto` as a storage class specifier may
79
  be invalid in this International Standard. In this International
80
  Standard, `auto` indicates that the type of a variable is to be deduced
81
  from its initializer expression.
82
 
83
  ### Clause [[dcl.decl]]: declarators <a id="diff.cpp03.dcl.decl">[[diff.cpp03.dcl.decl]]</a>
84
 
85
  [[dcl.init.list]] **Change:** Narrowing restrictions in aggregate
86
- initializers **Rationale:** Catches bugs. **Effect on original
87
  feature:** Valid C++03code may fail to compile in this International
88
  Standard. For example, the following code is valid in C++03but invalid
89
  in this International Standard because `double` to `int` is a narrowing
90
  conversion:
91
 
@@ -105,27 +117,24 @@ expression that is not potentially evaluated) becomes ill-formed.
105
 
106
  [[class.dtor]] (destructors) **Change:** User-declared destructors have
107
  an implicit exception specification. **Rationale:** Clarification of
108
  destructor requirements. **Effect on original feature:** Valid C++03code
109
  may execute differently in this International Standard. In particular,
110
- destructors that throw exceptions will call `std::terminate()` (without
111
- calling `std::unexpected()`) if their exception specification is
112
- `noexcept` or `noexcept(true)`. For a throwing virtual destructor of a
113
- derived class, `std::terminate()` can be avoided only if the base class
114
- virtual destructor has an exception specification that is not `noexcept`
115
- and not `noexcept(true)`.
116
 
117
  ### Clause [[temp]]: templates <a id="diff.cpp03.temp">[[diff.cpp03.temp]]</a>
118
 
119
- [[temp.param]] **Change:** Remove `export` **Rationale:** No
120
  implementation consensus. **Effect on original feature:** A valid
121
  C++03declaration containing `export` is ill-formed in this International
122
  Standard.
123
 
124
  [[temp.arg]] **Change:** Remove whitespace requirement for nested
125
- closing template right angle brackets **Rationale:** Considered a
126
- persistent but minor annoyance. Template aliases representing nonclass
127
  types would exacerbate whitespace issues. **Effect on original
128
  feature:** Change to semantics of well-defined expression. A valid
129
  C++03expression containing a right angle bracket (“`>`”) followed
130
  immediately by another right angle bracket may now be treated as closing
131
  two templates. For example, the following code is valid in C++03because
@@ -137,26 +146,26 @@ template <class T> struct X { };
137
  template <int N> struct Y { };
138
  X< Y< 1 >> 2 > > x;
139
  ```
140
 
141
  [[temp.dep.candidate]] **Change:** Allow dependent calls of functions
142
- with internal linkage **Rationale:** Overly constrained, simplify
143
  overload resolution rules. **Effect on original feature:** A valid
144
  C++03program could get a different result than this International
145
  Standard.
146
 
147
  ### Clause [[library]]: library introduction <a id="diff.cpp03.library">[[diff.cpp03.library]]</a>
148
 
149
- [[library]] – [[thread]] **Change:** New reserved identifiers
150
  **Rationale:** Required by new features. **Effect on original feature:**
151
  Valid C++03code that uses any identifiers added to the C++standard
152
  library by this International Standard may fail to compile or produce
153
- different results in This International Standard. A comprehensive list
154
  of identifiers used by the C++standard library can be found in the Index
155
  of Library Names in this International Standard.
156
 
157
- [[headers]] **Change:** New headers **Rationale:** New functionality.
158
  **Effect on original feature:** The following C++headers are new:
159
  `<array>`, `<atomic>`, `<chrono>`, `<codecvt>`, `<condition_variable>`,
160
  `<forward_list>`, `<future>`, `<initializer_list>`, `<mutex>`,
161
  `<random>`, `<ratio>`, `<regex>`, `<scoped_allocator>`,
162
  `<system_error>`, `<thread>`, `<tuple>`, `<typeindex>`,
@@ -171,26 +180,26 @@ in this International Standard.
171
  `swap` moved to a different header **Rationale:** Remove dependency on
172
  `<algorithm>` for `swap`. **Effect on original feature:** Valid
173
  C++03code that has been compiled expecting swap to be in `<algorithm>`
174
  may have to instead include `<utility>`.
175
 
176
- [[namespace.posix]] **Change:** New reserved namespace **Rationale:**
177
  New functionality. **Effect on original feature:** The global namespace
178
  `posix` is now reserved for standardization. Valid C++03code that uses a
179
  top-level namespace `posix` may be invalid in this International
180
  Standard.
181
 
182
  [[res.on.macro.definitions]] **Change:** Additional restrictions on
183
- macro names **Rationale:** Avoid hard to diagnose or non-portable
184
  constructs. **Effect on original feature:** Names of attribute
185
  identifiers may not be used as macro names. Valid C++ 2003 code that
186
  defines `override`, `final`, `carries_dependency`, or `noreturn` as
187
  macros is invalid in this International Standard.
188
 
189
  ### Clause [[language.support]]: language support library <a id="diff.cpp03.language.support">[[diff.cpp03.language.support]]</a>
190
 
191
- [[new.delete.single]] **Change:** Linking `new` and `delete` operators
192
  **Rationale:** The two throwing single-object signatures of
193
  `operator new` and `operator delete` are now specified to form the base
194
  functionality for the other operators. This clarifies that replacing
195
  just these two signatures changes others, even if they are not
196
  explicitly changed. **Effect on original feature:** Valid C++03code that
@@ -216,71 +225,70 @@ void operator delete(void* ptr) throw() {
216
  int main() {
217
  int* i = new int;
218
  delete i; // single-object delete
219
  int* a = new int[3];
220
  delete [] a; // array delete
221
- return 0;
222
  }
223
  ```
224
 
225
  [[new.delete.single]] **Change:** `operator new` may throw exceptions
226
- other than `std::bad_alloc` **Rationale:** Consistent application of
227
  `noexcept`. **Effect on original feature:** Valid C++03code that assumes
228
  that global `operator new` only throws `std::bad_alloc` may execute
229
  differently in this International Standard.
230
 
231
  ### Clause [[diagnostics]]: diagnostics library <a id="diff.cpp03.diagnostics">[[diff.cpp03.diagnostics]]</a>
232
 
233
- [[errno]] **Change:** Thread-local error numbers **Rationale:** Support
234
  for new thread facilities. **Effect on original feature:** Valid but
235
  implementation-specific C++03code that relies on `errno` being the same
236
  across threads may change behavior in this International Standard.
237
 
238
  ### Clause [[utilities]]: general utilities library <a id="diff.cpp03.utilities">[[diff.cpp03.utilities]]</a>
239
 
240
  [[util.dynamic.safety]] **Change:** Minimal support for
241
- garbage-collected regions **Rationale:** Required by new feature.
242
  **Effect on original feature:** Valid C++03code, compiled without
243
  traceable pointer support, that interacts with newer C++code using
244
  regions declared reachable may have different runtime behavior.
245
 
246
  [[refwrap]], [[arithmetic.operations]], [[comparisons]],
247
- [[logical.operations]], [[bitwise.operations]], [[negators]] **Change:**
248
- Standard function object types no longer derived from
249
- `std::unary_function` or `std::binary_function` **Rationale:**
250
- Superseded by new feature. **Effect on original feature:** Valid
251
- C++03code that depends on function object types being derived from
252
- `unary_function` or `binary_function` will execute differently in this
253
- International Standard.
254
 
255
  ### Clause [[strings]]: strings library <a id="diff.cpp03.strings">[[diff.cpp03.strings]]</a>
256
 
257
  [[string.classes]] **Change:** `basic_string` requirements no longer
258
- allow reference-counted strings **Rationale:** Invalidation is subtly
259
  different with reference-counted strings. This change regularizes
260
  behavior for this International Standard. **Effect on original
261
  feature:** Valid C++03code may execute differently in this International
262
  Standard.
263
 
264
- [[string.require]] **Change:** Loosen `basic_string` invalidation rules
265
  **Rationale:** Allow small-string optimization. **Effect on original
266
  feature:** Valid C++03code may execute differently in this International
267
  Standard. Some `const` member functions, such as `data` and `c_str`, no
268
  longer invalidate iterators.
269
 
270
  ### Clause [[containers]]: containers library <a id="diff.cpp03.containers">[[diff.cpp03.containers]]</a>
271
 
272
  [[container.requirements]] **Change:** Complexity of `size()` member
273
- functions now constant **Rationale:** Lack of specification of
274
  complexity of `size()` resulted in divergent implementations with
275
  inconsistent performance characteristics. **Effect on original
276
  feature:** Some container implementations that conform to C++03may not
277
  conform to the specified `size()` requirements in this International
278
  Standard. Adjusting containers such as `std::list` to the stricter
279
  requirements may require incompatible changes.
280
 
281
- [[container.requirements]] **Change:** Requirements change: relaxation
282
  **Rationale:** Clarification. **Effect on original feature:** Valid
283
  C++03code that attempts to meet the specified container requirements may
284
  now be over-specified. Code that attempted to be portable across
285
  containers may need to be adjusted as follows:
286
 
@@ -288,17 +296,17 @@ containers may need to be adjusted as follows:
288
  `size() == 0`;
289
  - not all containers are empty after construction (`array`);
290
  - not all containers have constant complexity for `swap()` (`array`).
291
 
292
  [[container.requirements]] **Change:** Requirements change: default
293
- constructible **Rationale:** Clarification of container requirements.
294
  **Effect on original feature:** Valid C++03code that attempts to
295
  explicitly instantiate a container using a user-defined type with no
296
  default constructor may fail to compile.
297
 
298
  [[sequence.reqmts]], [[associative.reqmts]] **Change:** Signature
299
- changes: from `void` return types **Rationale:** Old signature threw
300
  away useful information that may be expensive to recalculate. **Effect
301
  on original feature:** The following member functions have changed:
302
 
303
  - `erase(iter)` for `set`, `multiset`, `map`, `multimap`
304
  - `erase(begin, end)` for `set`, `multiset`, `map`, `multimap`
@@ -308,57 +316,56 @@ on original feature:** The following member functions have changed:
308
  Valid C++03code that relies on these functions returning `void` (e.g.,
309
  code that creates a pointer to member function that points to one of
310
  these functions) will fail to compile with this International Standard.
311
 
312
  [[sequence.reqmts]], [[associative.reqmts]] **Change:** Signature
313
- changes: from `iterator` to `const_iterator` parameters **Rationale:**
314
- Overspecification. *Effects:* The signatures of the following member
315
- functions changed from taking an `iterator` to taking a
316
  `const_iterator`:
317
 
318
  - `insert(iter, val)` for `vector`, `deque`, `list`, `set`, `multiset`,
319
  `map`, `multimap`
320
  - `insert(pos, beg, end)` for `vector`, `deque`, `list`, `forward_list`
321
- - `erase(iter)` for `set`, `multiset`, `map`, `multimap`
322
  - `erase(begin, end)` for `set`, `multiset`, `map`, `multimap`
323
  - all forms of `list::splice`
324
  - all forms of `list::merge`
325
 
326
  Valid C++03code that uses these functions may fail to compile with this
327
  International Standard.
328
 
329
  [[sequence.reqmts]], [[associative.reqmts]] **Change:** Signature
330
- changes: `resize` **Rationale:** Performance, compatibility with move
331
  semantics. **Effect on original feature:** For `vector`, `deque`, and
332
  `list` the fill value passed to `resize` is now passed by reference
333
  instead of by value, and an additional overload of `resize` has been
334
  added. Valid C++03code that uses this function may fail to compile with
335
  this International Standard.
336
 
337
  ### Clause [[algorithms]]: algorithms library <a id="diff.cpp03.algorithms">[[diff.cpp03.algorithms]]</a>
338
 
339
  [[algorithms.general]] **Change:** Result state of inputs after
340
- application of some algorithms **Rationale:** Required by new feature.
341
  **Effect on original feature:** A valid C++03program may detect that an
342
  object with a valid but unspecified state has a different valid but
343
  unspecified state with this International Standard. For example,
344
  `std::remove` and `std::remove_if` may leave the tail of the input
345
  sequence with a different set of values than previously.
346
 
347
  ### Clause [[numerics]]: numerics library <a id="diff.cpp03.numerics">[[diff.cpp03.numerics]]</a>
348
 
349
  [[complex.numbers]] **Change:** Specified representation of complex
350
- numbers **Rationale:** Compatibility with C99. **Effect on original
351
  feature:** Valid C++03code that uses implementation-specific knowledge
352
  about the binary representation of the required template specializations
353
  of `std::complex` may not be compatible with this International
354
  Standard.
355
 
356
- ### Clause [[input.output]]: Input/output library <a id="diff.cpp03.input.output">[[diff.cpp03.input.output]]</a>
357
 
358
  [[istream::sentry]], [[ostream::sentry]], [[iostate.flags]] **Change:**
359
- Specify use of explicit in existing boolean conversion operators
360
  **Rationale:** Clarify intentions, avoid workarounds. **Effect on
361
  original feature:** Valid C++03code that relies on implicit boolean
362
  conversions will fail to compile with this International Standard. Such
363
  conversions occur in the following conditions:
364
 
@@ -367,20 +374,20 @@ conversions occur in the following conditions:
367
  - returning a value from a function with a return type of `bool`;
368
  - initializing members of type `bool` via aggregate initialization;
369
  - initializing a `const bool&` which would bind to a temporary.
370
 
371
  [[ios::failure]] **Change:** Change base class of
372
- `std::ios_base::failure` **Rationale:** More detailed error messages.
373
  **Effect on original feature:** `std::ios_base::failure` is no longer
374
  derived directly from `std::exception`, but is now derived from
375
  `std::system_error`, which in turn is derived from `std::runtime_error`.
376
  Valid C++03code that assumes that `std::ios_base::failure` is derived
377
  directly from `std::exception` may execute differently in this
378
  International Standard.
379
 
380
  [[ios.base]] **Change:** Flag types in `std::ios_base` are now bitmasks
381
- with values defined as constexpr static members **Rationale:** Required
382
  for new features. **Effect on original feature:** Valid C++03code that
383
  relies on `std::ios_base` flag types being represented as `std::bitset`
384
  or as an integer type may fail to compile with this International
385
  Standard. For example:
386
 
@@ -388,9 +395,8 @@ Standard. For example:
388
  #include <iostream>
389
 
390
  int main() {
391
  int flag = std::ios_base::hex;
392
  std::cout.setf(flag); // error: setf does not take argument of type int
393
- return 0;
394
  }
395
  ```
396
 
 
4
  14882:2003, *Programming Languages — C++*), by the chapters of this
5
  document.
6
 
7
  ### Clause [[lex]]: lexical conventions <a id="diff.cpp03.lex">[[diff.cpp03.lex]]</a>
8
 
9
+ [[lex.pptoken]] **Change:** New kinds of string literals. **Rationale:**
10
  Required for new features. **Effect on original feature:** Valid
11
  C++03code may fail to compile or produce different results in this
12
  International Standard. Specifically, macros named `R`, `u8`, `u8R`,
13
  `u`, `uR`, `U`, `UR`, or `LR` will not be expanded when adjacent to a
14
  string literal but will be interpreted as part of the string literal.
 
17
  ``` cpp
18
  #define u8 "abc"
19
  const char* s = u8"def"; // Previously "abcdef", now "def"
20
  ```
21
 
22
+ [[lex.pptoken]] **Change:** User-defined literal string support.
23
  **Rationale:** Required for new features. **Effect on original
24
  feature:** Valid C++03code may fail to compile or produce different
25
  results in this International Standard, as the following example
26
  illustrates.
27
 
 
30
  "hello"_x // #1
31
  ```
32
 
33
  Previously, \#1 would have consisted of two separate preprocessing
34
  tokens and the macro `_x` would have been expanded. In this
35
+ International Standard, \#1 consists of a single preprocessing token, so
36
+ the macro is not expanded.
37
 
38
+ [[lex.key]] **Change:** New keywords. **Rationale:** Required for new
39
  features. **Effect on original feature:** Added to Table 
40
  [[tab:keywords]], the following identifiers are new keywords: `alignas`,
41
  `alignof`, `char16_t`, `char32_t`, `constexpr`, `decltype`, `noexcept`,
42
  `nullptr`, `static_assert`, and `thread_local`. Valid C++03code using
43
  these identifiers is invalid in this International Standard.
44
 
45
+ [[lex.icon]] **Change:** Type of integer literals. **Rationale:** C99
46
  compatibility. **Effect on original feature:** Certain integer literals
47
  larger than can be represented by `long` could change from an unsigned
48
  integer type to `signed long long`.
49
 
50
  ### Clause  [[conv]]: standard conversions <a id="diff.cpp03.conv">[[diff.cpp03.conv]]</a>
51
 
52
  [[conv.ptr]] **Change:** Only literals are integer null pointer
53
+ constants. **Rationale:** Removing surprising interactions with
54
+ templates and constant expressions. **Effect on original feature:**
55
+ Valid C++03code may fail to compile or produce different results in this
56
+ International Standard, as the following example illustrates:
57
 
58
  ``` cpp
59
  void f(void *); // #1
60
  void f(...); // #2
61
  template<int N> void g() {
 
64
  ```
65
 
66
  ### Clause [[expr]]: expressions <a id="diff.cpp03.expr">[[diff.cpp03.expr]]</a>
67
 
68
  [[expr.mul]] **Change:** Specify rounding for results of integer `/` and
69
+ `%`. **Rationale:** Increase portability, C99 compatibility. **Effect on
70
  original feature:** Valid C++03code that uses integer division rounds
71
  the result toward 0 or toward negative infinity, whereas this
72
  International Standard always rounds the result toward 0.
73
 
74
+ [[expr.log.and]] **Change:** `&&` is valid in a *type-name*.
75
+ **Rationale:** Required for new features. **Effect on original
76
+ feature:** Valid C++03code may fail to compile or produce different
77
+ results in this International Standard, as the following example
78
+ illustrates:
79
+
80
+ ``` cpp
81
+ bool b1 = new int && false; // previously false, now ill-formed
82
+ struct S { operator int(); };
83
+ bool b2 = &S::operator int && false; // previously false, now ill-formed
84
+ ```
85
+
86
  ### Clause [[dcl.dcl]]: declarations <a id="diff.cpp03.dcl.dcl">[[diff.cpp03.dcl.dcl]]</a>
87
 
88
+ [[dcl.spec]] **Change:** Remove `auto` as a storage class specifier.
89
  **Rationale:** New feature. **Effect on original feature:** Valid
90
  C++03code that uses the keyword `auto` as a storage class specifier may
91
  be invalid in this International Standard. In this International
92
  Standard, `auto` indicates that the type of a variable is to be deduced
93
  from its initializer expression.
94
 
95
  ### Clause [[dcl.decl]]: declarators <a id="diff.cpp03.dcl.decl">[[diff.cpp03.dcl.decl]]</a>
96
 
97
  [[dcl.init.list]] **Change:** Narrowing restrictions in aggregate
98
+ initializers. **Rationale:** Catches bugs. **Effect on original
99
  feature:** Valid C++03code may fail to compile in this International
100
  Standard. For example, the following code is valid in C++03but invalid
101
  in this International Standard because `double` to `int` is a narrowing
102
  conversion:
103
 
 
117
 
118
  [[class.dtor]] (destructors) **Change:** User-declared destructors have
119
  an implicit exception specification. **Rationale:** Clarification of
120
  destructor requirements. **Effect on original feature:** Valid C++03code
121
  may execute differently in this International Standard. In particular,
122
+ destructors that throw exceptions will call `std::terminate` (without
123
+ calling `std::unexpected`) if their exception specification is
124
+ non-throwing.
 
 
 
125
 
126
  ### Clause [[temp]]: templates <a id="diff.cpp03.temp">[[diff.cpp03.temp]]</a>
127
 
128
+ [[temp.param]] **Change:** Remove `export`. **Rationale:** No
129
  implementation consensus. **Effect on original feature:** A valid
130
  C++03declaration containing `export` is ill-formed in this International
131
  Standard.
132
 
133
  [[temp.arg]] **Change:** Remove whitespace requirement for nested
134
+ closing template right angle brackets. **Rationale:** Considered a
135
+ persistent but minor annoyance. Template aliases representing non-class
136
  types would exacerbate whitespace issues. **Effect on original
137
  feature:** Change to semantics of well-defined expression. A valid
138
  C++03expression containing a right angle bracket (“`>`”) followed
139
  immediately by another right angle bracket may now be treated as closing
140
  two templates. For example, the following code is valid in C++03because
 
146
  template <int N> struct Y { };
147
  X< Y< 1 >> 2 > > x;
148
  ```
149
 
150
  [[temp.dep.candidate]] **Change:** Allow dependent calls of functions
151
+ with internal linkage. **Rationale:** Overly constrained, simplify
152
  overload resolution rules. **Effect on original feature:** A valid
153
  C++03program could get a different result than this International
154
  Standard.
155
 
156
  ### Clause [[library]]: library introduction <a id="diff.cpp03.library">[[diff.cpp03.library]]</a>
157
 
158
+ [[library]] – [[thread]] **Change:** New reserved identifiers.
159
  **Rationale:** Required by new features. **Effect on original feature:**
160
  Valid C++03code that uses any identifiers added to the C++standard
161
  library by this International Standard may fail to compile or produce
162
+ different results in this International Standard. A comprehensive list
163
  of identifiers used by the C++standard library can be found in the Index
164
  of Library Names in this International Standard.
165
 
166
+ [[headers]] **Change:** New headers. **Rationale:** New functionality.
167
  **Effect on original feature:** The following C++headers are new:
168
  `<array>`, `<atomic>`, `<chrono>`, `<codecvt>`, `<condition_variable>`,
169
  `<forward_list>`, `<future>`, `<initializer_list>`, `<mutex>`,
170
  `<random>`, `<ratio>`, `<regex>`, `<scoped_allocator>`,
171
  `<system_error>`, `<thread>`, `<tuple>`, `<typeindex>`,
 
180
  `swap` moved to a different header **Rationale:** Remove dependency on
181
  `<algorithm>` for `swap`. **Effect on original feature:** Valid
182
  C++03code that has been compiled expecting swap to be in `<algorithm>`
183
  may have to instead include `<utility>`.
184
 
185
+ [[namespace.posix]] **Change:** New reserved namespace. **Rationale:**
186
  New functionality. **Effect on original feature:** The global namespace
187
  `posix` is now reserved for standardization. Valid C++03code that uses a
188
  top-level namespace `posix` may be invalid in this International
189
  Standard.
190
 
191
  [[res.on.macro.definitions]] **Change:** Additional restrictions on
192
+ macro names. **Rationale:** Avoid hard to diagnose or non-portable
193
  constructs. **Effect on original feature:** Names of attribute
194
  identifiers may not be used as macro names. Valid C++ 2003 code that
195
  defines `override`, `final`, `carries_dependency`, or `noreturn` as
196
  macros is invalid in this International Standard.
197
 
198
  ### Clause [[language.support]]: language support library <a id="diff.cpp03.language.support">[[diff.cpp03.language.support]]</a>
199
 
200
+ [[new.delete.single]] **Change:** Linking `new` and `delete` operators.
201
  **Rationale:** The two throwing single-object signatures of
202
  `operator new` and `operator delete` are now specified to form the base
203
  functionality for the other operators. This clarifies that replacing
204
  just these two signatures changes others, even if they are not
205
  explicitly changed. **Effect on original feature:** Valid C++03code that
 
225
  int main() {
226
  int* i = new int;
227
  delete i; // single-object delete
228
  int* a = new int[3];
229
  delete [] a; // array delete
 
230
  }
231
  ```
232
 
233
  [[new.delete.single]] **Change:** `operator new` may throw exceptions
234
+ other than `std::bad_alloc`. **Rationale:** Consistent application of
235
  `noexcept`. **Effect on original feature:** Valid C++03code that assumes
236
  that global `operator new` only throws `std::bad_alloc` may execute
237
  differently in this International Standard.
238
 
239
  ### Clause [[diagnostics]]: diagnostics library <a id="diff.cpp03.diagnostics">[[diff.cpp03.diagnostics]]</a>
240
 
241
+ [[errno]] **Change:** Thread-local error numbers. **Rationale:** Support
242
  for new thread facilities. **Effect on original feature:** Valid but
243
  implementation-specific C++03code that relies on `errno` being the same
244
  across threads may change behavior in this International Standard.
245
 
246
  ### Clause [[utilities]]: general utilities library <a id="diff.cpp03.utilities">[[diff.cpp03.utilities]]</a>
247
 
248
  [[util.dynamic.safety]] **Change:** Minimal support for
249
+ garbage-collected regions. **Rationale:** Required by new feature.
250
  **Effect on original feature:** Valid C++03code, compiled without
251
  traceable pointer support, that interacts with newer C++code using
252
  regions declared reachable may have different runtime behavior.
253
 
254
  [[refwrap]], [[arithmetic.operations]], [[comparisons]],
255
+ [[logical.operations]], [[bitwise.operations]], [[depr.negators]]
256
+ **Change:** Standard function object types no longer derived from
257
+ `std::unary_function` or `std::binary_function`. **Rationale:**
258
+ Superseded by new feature; `unary_function` and `binary_function` are no
259
+ longer defined. **Effect on original feature:** Valid C++03code that
260
+ depends on function object types being derived from `unary_function` or
261
+ `binary_function` may fail to compile in this International Standard.
262
 
263
  ### Clause [[strings]]: strings library <a id="diff.cpp03.strings">[[diff.cpp03.strings]]</a>
264
 
265
  [[string.classes]] **Change:** `basic_string` requirements no longer
266
+ allow reference-counted strings. **Rationale:** Invalidation is subtly
267
  different with reference-counted strings. This change regularizes
268
  behavior for this International Standard. **Effect on original
269
  feature:** Valid C++03code may execute differently in this International
270
  Standard.
271
 
272
+ [[string.require]] **Change:** Loosen `basic_string` invalidation rules.
273
  **Rationale:** Allow small-string optimization. **Effect on original
274
  feature:** Valid C++03code may execute differently in this International
275
  Standard. Some `const` member functions, such as `data` and `c_str`, no
276
  longer invalidate iterators.
277
 
278
  ### Clause [[containers]]: containers library <a id="diff.cpp03.containers">[[diff.cpp03.containers]]</a>
279
 
280
  [[container.requirements]] **Change:** Complexity of `size()` member
281
+ functions now constant. **Rationale:** Lack of specification of
282
  complexity of `size()` resulted in divergent implementations with
283
  inconsistent performance characteristics. **Effect on original
284
  feature:** Some container implementations that conform to C++03may not
285
  conform to the specified `size()` requirements in this International
286
  Standard. Adjusting containers such as `std::list` to the stricter
287
  requirements may require incompatible changes.
288
 
289
+ [[container.requirements]] **Change:** Requirements change: relaxation.
290
  **Rationale:** Clarification. **Effect on original feature:** Valid
291
  C++03code that attempts to meet the specified container requirements may
292
  now be over-specified. Code that attempted to be portable across
293
  containers may need to be adjusted as follows:
294
 
 
296
  `size() == 0`;
297
  - not all containers are empty after construction (`array`);
298
  - not all containers have constant complexity for `swap()` (`array`).
299
 
300
  [[container.requirements]] **Change:** Requirements change: default
301
+ constructible. **Rationale:** Clarification of container requirements.
302
  **Effect on original feature:** Valid C++03code that attempts to
303
  explicitly instantiate a container using a user-defined type with no
304
  default constructor may fail to compile.
305
 
306
  [[sequence.reqmts]], [[associative.reqmts]] **Change:** Signature
307
+ changes: from `void` return types. **Rationale:** Old signature threw
308
  away useful information that may be expensive to recalculate. **Effect
309
  on original feature:** The following member functions have changed:
310
 
311
  - `erase(iter)` for `set`, `multiset`, `map`, `multimap`
312
  - `erase(begin, end)` for `set`, `multiset`, `map`, `multimap`
 
316
  Valid C++03code that relies on these functions returning `void` (e.g.,
317
  code that creates a pointer to member function that points to one of
318
  these functions) will fail to compile with this International Standard.
319
 
320
  [[sequence.reqmts]], [[associative.reqmts]] **Change:** Signature
321
+ changes: from `iterator` to `const_iterator` parameters. **Rationale:**
322
+ Overspecification. **Effect on original feature:** The signatures of the
323
+ following member functions changed from taking an `iterator` to taking a
324
  `const_iterator`:
325
 
326
  - `insert(iter, val)` for `vector`, `deque`, `list`, `set`, `multiset`,
327
  `map`, `multimap`
328
  - `insert(pos, beg, end)` for `vector`, `deque`, `list`, `forward_list`
 
329
  - `erase(begin, end)` for `set`, `multiset`, `map`, `multimap`
330
  - all forms of `list::splice`
331
  - all forms of `list::merge`
332
 
333
  Valid C++03code that uses these functions may fail to compile with this
334
  International Standard.
335
 
336
  [[sequence.reqmts]], [[associative.reqmts]] **Change:** Signature
337
+ changes: `resize`. **Rationale:** Performance, compatibility with move
338
  semantics. **Effect on original feature:** For `vector`, `deque`, and
339
  `list` the fill value passed to `resize` is now passed by reference
340
  instead of by value, and an additional overload of `resize` has been
341
  added. Valid C++03code that uses this function may fail to compile with
342
  this International Standard.
343
 
344
  ### Clause [[algorithms]]: algorithms library <a id="diff.cpp03.algorithms">[[diff.cpp03.algorithms]]</a>
345
 
346
  [[algorithms.general]] **Change:** Result state of inputs after
347
+ application of some algorithms. **Rationale:** Required by new feature.
348
  **Effect on original feature:** A valid C++03program may detect that an
349
  object with a valid but unspecified state has a different valid but
350
  unspecified state with this International Standard. For example,
351
  `std::remove` and `std::remove_if` may leave the tail of the input
352
  sequence with a different set of values than previously.
353
 
354
  ### Clause [[numerics]]: numerics library <a id="diff.cpp03.numerics">[[diff.cpp03.numerics]]</a>
355
 
356
  [[complex.numbers]] **Change:** Specified representation of complex
357
+ numbers. **Rationale:** Compatibility with C99. **Effect on original
358
  feature:** Valid C++03code that uses implementation-specific knowledge
359
  about the binary representation of the required template specializations
360
  of `std::complex` may not be compatible with this International
361
  Standard.
362
 
363
+ ### Clause [[input.output]]: input/output library <a id="diff.cpp03.input.output">[[diff.cpp03.input.output]]</a>
364
 
365
  [[istream::sentry]], [[ostream::sentry]], [[iostate.flags]] **Change:**
366
+ Specify use of `explicit` in existing boolean conversion functions.
367
  **Rationale:** Clarify intentions, avoid workarounds. **Effect on
368
  original feature:** Valid C++03code that relies on implicit boolean
369
  conversions will fail to compile with this International Standard. Such
370
  conversions occur in the following conditions:
371
 
 
374
  - returning a value from a function with a return type of `bool`;
375
  - initializing members of type `bool` via aggregate initialization;
376
  - initializing a `const bool&` which would bind to a temporary.
377
 
378
  [[ios::failure]] **Change:** Change base class of
379
+ `std::ios_base::failure`. **Rationale:** More detailed error messages.
380
  **Effect on original feature:** `std::ios_base::failure` is no longer
381
  derived directly from `std::exception`, but is now derived from
382
  `std::system_error`, which in turn is derived from `std::runtime_error`.
383
  Valid C++03code that assumes that `std::ios_base::failure` is derived
384
  directly from `std::exception` may execute differently in this
385
  International Standard.
386
 
387
  [[ios.base]] **Change:** Flag types in `std::ios_base` are now bitmasks
388
+ with values defined as constexpr static members. **Rationale:** Required
389
  for new features. **Effect on original feature:** Valid C++03code that
390
  relies on `std::ios_base` flag types being represented as `std::bitset`
391
  or as an integer type may fail to compile with this International
392
  Standard. For example:
393
 
 
395
  #include <iostream>
396
 
397
  int main() {
398
  int flag = std::ios_base::hex;
399
  std::cout.setf(flag); // error: setf does not take argument of type int
 
400
  }
401
  ```
402