From Jason Turner

[basic.stc.dynamic.deallocation]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwuvzd429/{from.md → to.md} +20 -39
tmp/tmpwuvzd429/{from.md → to.md} RENAMED
@@ -4,57 +4,38 @@ Deallocation functions shall be class member functions or global
4
  functions; a program is ill-formed if deallocation functions are
5
  declared in a namespace scope other than global scope or declared static
6
  in global scope.
7
 
8
  Each deallocation function shall return `void` and its first parameter
9
- shall be `void*`. A deallocation function can have more than one
10
- parameter. The global `operator delete` with exactly one parameter is a
11
- usual (non-placement) deallocation function. The global
12
- `operator delete` with exactly two parameters, the second of which has
13
- type `std::size_t`, is a usual deallocation function. Similarly, the
14
- global `operator delete[]` with exactly one parameter is a usual
15
- deallocation function. The global `operator delete[]` with exactly two
16
- parameters, the second of which has type `std::size_t`, is a usual
17
- deallocation function.[^13] If a class `T` has a member deallocation
18
- function named `operator` `delete` with exactly one parameter, then that
19
- function is a usual deallocation function. If class `T` does not declare
20
- such an `operator` `delete` but does declare a member deallocation
21
- function named `operator` `delete` with exactly two parameters, the
22
- second of which has type `std::size_t`, then this function is a usual
23
- deallocation function. Similarly, if a class `T` has a member
24
- deallocation function named `operator` `delete[]` with exactly one
25
- parameter, then that function is a usual (non-placement) deallocation
26
- function. If class `T` does not declare such an `operator` `delete[]`
27
- but does declare a member deallocation function named `operator`
28
- `delete[]` with exactly two parameters, the second of which has type
29
- `std::size_t`, then this function is a usual deallocation function. A
30
- deallocation function can be an instance of a function template. Neither
31
- the first parameter nor the return type shall depend on a template
32
- parameter. That is, a deallocation function template shall have a first
33
  parameter of type `void*` and a return type of `void` (as specified
34
- above). A deallocation function template shall have two or more function
 
 
35
  parameters. A template instance is never a usual deallocation function,
36
  regardless of its signature.
37
 
38
  If a deallocation function terminates by throwing an exception, the
39
  behavior is undefined. The value of the first argument supplied to a
40
  deallocation function may be a null pointer value; if so, and if the
41
  deallocation function is one supplied in the standard library, the call
42
- has no effect. Otherwise, the behavior is undefined if the value
43
- supplied to `operator` `delete(void*)` in the standard library is not
44
- one of the values returned by a previous invocation of either `operator`
45
- `new(std::size_t)` or `operator` `new(std::size_t,` `const`
46
- `std::nothrow_t&)` in the standard library, and the behavior is
47
- undefined if the value supplied to `operator` `delete[](void*)` in the
48
- standard library is not one of the values returned by a previous
49
- invocation of either `operator` `new[](std::size_t)` or `operator`
50
- `new[](std::size_t,` `const` `std::nothrow_t&)` in the standard library.
51
 
52
  If the argument given to a deallocation function in the standard library
53
  is a pointer that is not the null pointer value ([[conv.ptr]]), the
54
  deallocation function shall deallocate the storage referenced by the
55
- pointer, rendering invalid all pointers referring to any part of the
56
- deallocated storage. Indirection through an invalid pointer value and
57
- passing an invalid pointer value to a deallocation function have
58
- undefined behavior. Any other use of an invalid pointer value has
59
- implementation-defined behavior.[^14]
60
 
 
4
  functions; a program is ill-formed if deallocation functions are
5
  declared in a namespace scope other than global scope or declared static
6
  in global scope.
7
 
8
  Each deallocation function shall return `void` and its first parameter
9
+ shall be `void*`. A deallocation function may have more than one
10
+ parameter. A *usual deallocation function* is a deallocation function
11
+ that has:
12
+
13
+ - exactly one parameter; or
14
+ - exactly two parameters, the type of the second being either
15
+ `std::align_val_t` or `std::size_t` [^14]; or
16
+ - exactly three parameters, the type of the second being `std::size_t`
17
+ and the type of the third being `std::align_val_t`.
18
+
19
+ A deallocation function may be an instance of a function template.
20
+ Neither the first parameter nor the return type shall depend on a
21
+ template parameter.
22
+
23
+ [*Note 1*: That is, a deallocation function template shall have a first
 
 
 
 
 
 
 
 
 
24
  parameter of type `void*` and a return type of `void` (as specified
25
+ above). *end note*]
26
+
27
+ A deallocation function template shall have two or more function
28
  parameters. A template instance is never a usual deallocation function,
29
  regardless of its signature.
30
 
31
  If a deallocation function terminates by throwing an exception, the
32
  behavior is undefined. The value of the first argument supplied to a
33
  deallocation function may be a null pointer value; if so, and if the
34
  deallocation function is one supplied in the standard library, the call
35
+ has no effect.
 
 
 
 
 
 
 
 
36
 
37
  If the argument given to a deallocation function in the standard library
38
  is a pointer that is not the null pointer value ([[conv.ptr]]), the
39
  deallocation function shall deallocate the storage referenced by the
40
+ pointer, ending the duration of the region of storage.
 
 
 
 
41