From Jason Turner

[new.delete.array]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpa0wxn0it/{from.md → to.md} +26 -34
tmp/tmpa0wxn0it/{from.md → to.md} RENAMED
@@ -6,11 +6,11 @@
6
  ```
7
 
8
  *Effects:* The allocation functions [[basic.stc.dynamic.allocation]]
9
  called by the array form of a *new-expression*[[expr.new]] to allocate
10
  `size` bytes of storage. The second form is called for a type with
11
- new-extended alignment, and the first form is called otherwise. [^33]
12
 
13
  *Replaceable:* A C++ program may define functions with either of these
14
  function signatures, and thereby displace the default versions defined
15
  by the C++ standard library.
16
 
@@ -52,10 +52,23 @@ void operator delete[](void* ptr) noexcept;
52
  void operator delete[](void* ptr, std::size_t size) noexcept;
53
  void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
54
  void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
55
  ```
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
58
  called by the array form of a *delete-expression* to render the value of
59
  `ptr` invalid.
60
 
61
  *Replaceable:* A C++ program may define functions with any of these
@@ -65,31 +78,14 @@ by the C++ standard library.
65
  If a function without a `size` parameter is defined, the program should
66
  also define the corresponding function with a `size` parameter. If a
67
  function with a `size` parameter is defined, the program shall also
68
  define the corresponding version without the `size` parameter.
69
 
70
- [*Note 1*: The default behavior below may change in the future, which
71
  will require replacing both deallocation functions when replacing the
72
  allocation function. — *end note*]
73
 
74
- *Preconditions:* `ptr` is a null pointer or its value represents the
75
- address of a block of memory allocated by an earlier call to a (possibly
76
- replaced) `operator new[](std::size_t)` or
77
- `operator new[](std::size_t, std::align_val_t)` which has not been
78
- invalidated by an intervening call to `operator delete[]`.
79
-
80
- *Preconditions:* If an implementation has strict pointer
81
- safety [[basic.stc.dynamic.safety]] then `ptr` is a safely-derived
82
- pointer.
83
-
84
- *Preconditions:* If the `alignment` parameter is not present, `ptr` was
85
- returned by an allocation function without an `alignment` parameter. If
86
- present, the `alignment` argument is equal to the `alignment` argument
87
- passed to the allocation function that returned `ptr`. If present, the
88
- `size` argument is equal to the `size` argument passed to the allocation
89
- function that returned `ptr`.
90
-
91
  *Required behavior:* A call to an `operator delete[]` with a `size`
92
  parameter may be changed to a call to the corresponding
93
  `operator delete[]` without a `size` parameter, without affecting memory
94
  allocation.
95
 
@@ -106,32 +102,28 @@ function.
106
  ``` cpp
107
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
108
  void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
109
  ```
110
 
 
 
 
 
 
 
 
 
 
 
 
111
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
112
  called by the implementation to render the value of `ptr` invalid when
113
  the constructor invoked from a nothrow placement version of the array
114
  *new-expression* throws an exception.
115
 
116
  *Replaceable:* A C++ program may define functions with either of these
117
  function signatures, and thereby displace the default versions defined
118
  by the C++ standard library.
119
 
120
- *Preconditions:* `ptr` is a null pointer or its value represents the
121
- address of a block of memory allocated by an earlier call to a (possibly
122
- replaced) `operator new[](std::size_t)` or
123
- `operator new[](std::size_t, std::align_val_t)` which has not been
124
- invalidated by an intervening call to `operator delete[]`.
125
-
126
- *Preconditions:* If an implementation has strict pointer
127
- safety [[basic.stc.dynamic.safety]] then `ptr` is a safely-derived
128
- pointer.
129
-
130
- *Preconditions:* If the `alignment` parameter is not present, `ptr` was
131
- returned by an allocation function without an `alignment` parameter. If
132
- present, the `alignment` argument is equal to the `alignment` argument
133
- passed to the allocation function that returned `ptr`.
134
-
135
  *Default behavior:* Calls `operator delete[](ptr)`, or
136
  `operator delete[](ptr, alignment)`, respectively.
137
 
 
6
  ```
7
 
8
  *Effects:* The allocation functions [[basic.stc.dynamic.allocation]]
9
  called by the array form of a *new-expression*[[expr.new]] to allocate
10
  `size` bytes of storage. The second form is called for a type with
11
+ new-extended alignment, and the first form is called otherwise.[^31]
12
 
13
  *Replaceable:* A C++ program may define functions with either of these
14
  function signatures, and thereby displace the default versions defined
15
  by the C++ standard library.
16
 
 
52
  void operator delete[](void* ptr, std::size_t size) noexcept;
53
  void operator delete[](void* ptr, std::align_val_t alignment) noexcept;
54
  void operator delete[](void* ptr, std::size_t size, std::align_val_t alignment) noexcept;
55
  ```
56
 
57
+ *Preconditions:* `ptr` is a null pointer or its value represents the
58
+ address of a block of memory allocated by an earlier call to a (possibly
59
+ replaced) `operator new[](std::size_t)` or
60
+ `operator new[](std::size_t, std::align_val_t)` which has not been
61
+ invalidated by an intervening call to `operator delete[]`.
62
+
63
+ If the `alignment` parameter is not present, `ptr` was returned by an
64
+ allocation function without an `alignment` parameter. If present, the
65
+ `alignment` argument is equal to the `alignment` argument passed to the
66
+ allocation function that returned `ptr`. If present, the `size` argument
67
+ is equal to the `size` argument passed to the allocation function that
68
+ returned `ptr`.
69
+
70
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
71
  called by the array form of a *delete-expression* to render the value of
72
  `ptr` invalid.
73
 
74
  *Replaceable:* A C++ program may define functions with any of these
 
78
  If a function without a `size` parameter is defined, the program should
79
  also define the corresponding function with a `size` parameter. If a
80
  function with a `size` parameter is defined, the program shall also
81
  define the corresponding version without the `size` parameter.
82
 
83
+ [*Note 1*: The default behavior below might change in the future, which
84
  will require replacing both deallocation functions when replacing the
85
  allocation function. — *end note*]
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  *Required behavior:* A call to an `operator delete[]` with a `size`
88
  parameter may be changed to a call to the corresponding
89
  `operator delete[]` without a `size` parameter, without affecting memory
90
  allocation.
91
 
 
102
  ``` cpp
103
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
104
  void operator delete[](void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept;
105
  ```
106
 
107
+ *Preconditions:* `ptr` is a null pointer or its value represents the
108
+ address of a block of memory allocated by an earlier call to a (possibly
109
+ replaced) `operator new[](std::size_t)` or
110
+ `operator new[](std::size_t, std::align_val_t)` which has not been
111
+ invalidated by an intervening call to `operator delete[]`.
112
+
113
+ If the `alignment` parameter is not present, `ptr` was returned by an
114
+ allocation function without an `alignment` parameter. If present, the
115
+ `alignment` argument is equal to the `alignment` argument passed to the
116
+ allocation function that returned `ptr`.
117
+
118
  *Effects:* The deallocation functions [[basic.stc.dynamic.deallocation]]
119
  called by the implementation to render the value of `ptr` invalid when
120
  the constructor invoked from a nothrow placement version of the array
121
  *new-expression* throws an exception.
122
 
123
  *Replaceable:* A C++ program may define functions with either of these
124
  function signatures, and thereby displace the default versions defined
125
  by the C++ standard library.
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  *Default behavior:* Calls `operator delete[](ptr)`, or
128
  `operator delete[](ptr, alignment)`, respectively.
129