From Jason Turner

[diff.cpp03.language.support]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpli0mpseo/{from.md → to.md} +10 -40
tmp/tmpli0mpseo/{from.md → to.md} RENAMED
@@ -1,41 +1,11 @@
1
- ### Clause [[language.support]]: language support library <a id="diff.cpp03.language.support">[[diff.cpp03.language.support]]</a>
2
-
3
- [[new.delete.single]] **Change:** Linking `new` and `delete` operators.
4
- **Rationale:** The two throwing single-object signatures of
5
- `operator new` and `operator delete` are now specified to form the base
6
- functionality for the other operators. This clarifies that replacing
7
- just these two signatures changes others, even if they are not
8
- explicitly changed. **Effect on original feature:** Valid C++03code that
9
- replaces global `new` or `delete` operators may execute differently in
10
- this International Standard. For example, the following program should
11
- write `"custom deallocation"` twice, once for the single-object delete
12
- and once for the array delete.
13
-
14
- ``` cpp
15
- #include <cstdio>
16
- #include <cstdlib>
17
- #include <new>
18
-
19
- void* operator new(std::size_t size) throw(std::bad_alloc) {
20
- return std::malloc(size);
21
- }
22
-
23
- void operator delete(void* ptr) throw() {
24
- std::puts("custom deallocation");
25
- std::free(ptr);
26
- }
27
-
28
- int main() {
29
- int* i = new int;
30
- delete i; // single-object delete
31
- int* a = new int[3];
32
- delete [] a; // array delete
33
- }
34
- ```
35
-
36
- [[new.delete.single]] **Change:** `operator new` may throw exceptions
37
- other than `std::bad_alloc`. **Rationale:** Consistent application of
38
- `noexcept`. **Effect on original feature:** Valid C++03code that assumes
39
- that global `operator new` only throws `std::bad_alloc` may execute
40
- differently in this International Standard.
41
 
 
1
+ ### [[support]]: language support library <a id="diff.cpp03.language.support">[[diff.cpp03.language.support]]</a>
2
+
3
+ **Change:** `operator new` may throw exceptions other than
4
+ `std::bad_alloc`. **Rationale:** Consistent application of `noexcept`.
5
+ **Effect on original feature:** Valid C++03 code that assumes that
6
+ global `operator new` only throws `std::bad_alloc` may execute
7
+ differently in this International Standard. Valid C++03 code that
8
+ replaces the global replaceable `operator new` is ill-formed in this
9
+ International Standard, because the exception specification of
10
+ `throw(std::bad_alloc)` was removed.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11