From Jason Turner

[new.delete.array]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp0sp8fhhv/{from.md → to.md} +50 -8
tmp/tmp0sp8fhhv/{from.md → to.md} RENAMED
@@ -38,46 +38,88 @@ requirement is binding on a replacement version of this function.
38
  normally, returns the result of that call. Otherwise, returns a null
39
  pointer.
40
 
41
  ``` cpp
42
  void operator delete[](void* ptr) noexcept;
 
43
  ```
44
 
45
  *Effects:* The *deallocation
46
  function* ([[basic.stc.dynamic.deallocation]]) called by the array form
47
  of a *delete-expression* to render the value of `ptr` invalid.
48
 
49
- *Replaceable:* a C++program can define a function with this function
50
- signature that displaces the default version defined by the C++standard
51
- library.
 
 
 
 
 
 
52
 
53
  *Requires:* *ptr* shall be a null pointer or its value shall be the
54
  value returned by an earlier call to `operator new[](std::size_t)` or
55
  `operator new[](std::size_t,const std::nothrow_t&)` which has not been
56
  invalidated by an intervening call to `operator delete[](void*)`.
57
 
 
 
 
 
 
 
 
 
 
 
58
  *Requires:* If an implementation has strict pointer
59
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
60
  safely-derived pointer.
61
 
62
- *Default behavior:* Calls `operator delete(ptr)`.
 
 
63
 
64
  ``` cpp
65
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
 
66
  ```
67
 
68
  *Effects:* The *deallocation
69
  function* ([[basic.stc.dynamic.deallocation]]) called by the
70
  implementation to render the value of `ptr` invalid when the constructor
71
  invoked from a nothrow placement version of the array *new-expression*
72
  throws an exception.
73
 
74
- *Replaceable:* a C++program may define a function with this function
75
- signature that displaces the default version defined by the C++standard
76
- library.
 
 
 
 
 
 
 
77
 
78
  *Requires:* If an implementation has strict pointer
79
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
80
  safely-derived pointer.
81
 
82
- *Default behavior:* calls `operator delete[](ptr)`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
 
38
  normally, returns the result of that call. Otherwise, returns a null
39
  pointer.
40
 
41
  ``` cpp
42
  void operator delete[](void* ptr) noexcept;
43
+ void operator delete[](void* ptr, std::size_t size) noexcept;
44
  ```
45
 
46
  *Effects:* The *deallocation
47
  function* ([[basic.stc.dynamic.deallocation]]) called by the array form
48
  of a *delete-expression* to render the value of `ptr` invalid.
49
 
50
+ *Replaceable:* a C++program can define a function with signature
51
+ `void operator delete[](void* ptr) noexcept` that displaces the default
52
+ version defined by the C++standard library. If this function (without
53
+ `size` parameter) is defined, the program should also define
54
+ `void operator delete[](void* ptr, std::size_t size) noexcept`. If this
55
+ function with `size` parameter is defined, the program shall also define
56
+ the version without the `size` parameter. The default behavior below may
57
+ change in the future, which will require replacing both deallocation
58
+ functions when replacing the allocation function.
59
 
60
  *Requires:* *ptr* shall be a null pointer or its value shall be the
61
  value returned by an earlier call to `operator new[](std::size_t)` or
62
  `operator new[](std::size_t,const std::nothrow_t&)` which has not been
63
  invalidated by an intervening call to `operator delete[](void*)`.
64
 
65
+ *Requires:* If present, the `std::size_t size` argument must equal the
66
+ size argument passed to the allocation function that returned `ptr`.
67
+
68
+ *Required behavior:* Calls to
69
+ `operator delete[](void* ptr, std::size_t size)` may be changed to calls
70
+ to `operator delete[](void* ptr)` without affecting memory allocation. A
71
+ conforming implementation is for
72
+ `operator delete[](void* ptr, std::size_t size)` to simply call
73
+ `operator delete[](void* ptr)`.
74
+
75
  *Requires:* If an implementation has strict pointer
76
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
77
  safely-derived pointer.
78
 
79
+ *Default behavior:* `operator delete[](void* ptr, std::size_t size)`
80
+ calls `operator delete[](ptr)`, and `operator delete[](void* ptr)` calls
81
+ `operator delete(ptr)`.
82
 
83
  ``` cpp
84
  void operator delete[](void* ptr, const std::nothrow_t&) noexcept;
85
+ void operator delete[](void* ptr, std::size_t size, const std::nothrow_t&) noexcept;
86
  ```
87
 
88
  *Effects:* The *deallocation
89
  function* ([[basic.stc.dynamic.deallocation]]) called by the
90
  implementation to render the value of `ptr` invalid when the constructor
91
  invoked from a nothrow placement version of the array *new-expression*
92
  throws an exception.
93
 
94
+ *Replaceable:* a C++program may define a function with signature
95
+ `void operator delete[](void* ptr, const std::nothrow_t&) noexcept` that
96
+ displaces the default version defined by the C++standard library. If
97
+ this function (without `size` parameter) is defined, the program should
98
+ also define
99
+ `void operator delete[](void* ptr, std::size_t size, const std::nothrow_t&) noexcept`.
100
+ If this function with `size` parameter is defined, the program shall
101
+ also define the version without the `size` parameter. The default
102
+ behavior below may change in the future, which will require replacing
103
+ both deallocation functions when replacing the allocation function.
104
 
105
  *Requires:* If an implementation has strict pointer
106
  safety ([[basic.stc.dynamic.safety]]) then `ptr` shall be a
107
  safely-derived pointer.
108
 
109
+ *Requires:* If present, the `std::size_t size` argument must equal the
110
+ size argument passed to the allocation function that returned `ptr`.
111
+
112
+ *Required behavior:* Calls to
113
+ `operator delete[](void* ptr, std::size_t size, const std::nothrow_t&)`
114
+ may be changed to calls to
115
+ `operator delete[](void* ptr, const std::nothrow_t&)` without affecting
116
+ memory allocation. A conforming implementation is for
117
+ `operator delete[](void* ptr, std::size_t size, const std::nothrow_t&)`
118
+ to simply call `operator delete[](void* ptr, const std::nothrow_t&)`.
119
+
120
+ *Default behavior:*
121
+ `operator delete[](void* ptr, std::size_t size, const std::nothrow_t&)`
122
+ calls `operator delete[](ptr, std::nothrow)`, and
123
+ `operator delete[](void* ptr, const std::nothrow_t&)` calls
124
+ `operator delete[](ptr)`.
125