From Jason Turner

[basic.stc.dynamic.safety]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpaamt9ryo/{from.md → to.md} +13 -8
tmp/tmpaamt9ryo/{from.md → to.md} RENAMED
@@ -11,11 +11,12 @@ A *traceable pointer object* is
11
 
12
  A pointer value is a *safely-derived pointer* to a dynamic object only
13
  if it has an object pointer type and it is one of the following:
14
 
15
  - the value returned by a call to the C++standard library implementation
16
- of `::operator new(std::size_t)`;[^15]
 
17
  - the result of taking the address of an object (or one of its
18
  subobjects) designated by an lvalue resulting from indirection through
19
  a safely-derived pointer value;
20
  - the result of well-defined pointer arithmetic ([[expr.add]]) using a
21
  safely-derived pointer value;
@@ -26,13 +27,13 @@ if it has an object pointer type and it is one of the following:
26
  safely-derived pointer value;
27
  - the value of an object whose value was copied from a traceable pointer
28
  object, where at the time of the copy the source object contained a
29
  copy of a safely-derived pointer value.
30
 
31
- An integer value is an
32
- *integer representation of a safely-derived pointer* only if its type is
33
- at least as large as `std::intptr_t` and it is one of the following:
34
 
35
  - the result of a `reinterpret_cast` of a safely-derived pointer value;
36
  - the result of a valid conversion of an integer representation of a
37
  safely-derived pointer value;
38
  - the value of an object whose value was copied from a traceable pointer
@@ -49,12 +50,16 @@ validity of a pointer value does not depend on whether it is a
49
  safely-derived pointer value. Alternatively, an implementation may have
50
  *strict pointer safety*, in which case a pointer value referring to an
51
  object with dynamic storage duration that is not a safely-derived
52
  pointer value is an invalid pointer value unless the referenced complete
53
  object has previously been declared reachable (
54
- [[util.dynamic.safety]]). the effect of using an invalid pointer value
55
- (including passing it to a deallocation function) is undefined, see 
 
 
56
  [[basic.stc.dynamic.deallocation]]. This is true even if the
57
  unsafely-derived pointer value might compare equal to some
58
- safely-derived pointer value. It is implementation defined whether an
59
- implementation has relaxed or strict pointer safety.
 
 
60
 
 
11
 
12
  A pointer value is a *safely-derived pointer* to a dynamic object only
13
  if it has an object pointer type and it is one of the following:
14
 
15
  - the value returned by a call to the C++standard library implementation
16
+ of `::operator new(std::{}size_t)` or
17
+ `::operator new(std::size_t, std::align_val_t)` ;[^15]
18
  - the result of taking the address of an object (or one of its
19
  subobjects) designated by an lvalue resulting from indirection through
20
  a safely-derived pointer value;
21
  - the result of well-defined pointer arithmetic ([[expr.add]]) using a
22
  safely-derived pointer value;
 
27
  safely-derived pointer value;
28
  - the value of an object whose value was copied from a traceable pointer
29
  object, where at the time of the copy the source object contained a
30
  copy of a safely-derived pointer value.
31
 
32
+ An integer value is an *integer representation of a safely-derived
33
+ pointer* only if its type is at least as large as `std::intptr_t` and it
34
+ is one of the following:
35
 
36
  - the result of a `reinterpret_cast` of a safely-derived pointer value;
37
  - the result of a valid conversion of an integer representation of a
38
  safely-derived pointer value;
39
  - the value of an object whose value was copied from a traceable pointer
 
50
  safely-derived pointer value. Alternatively, an implementation may have
51
  *strict pointer safety*, in which case a pointer value referring to an
52
  object with dynamic storage duration that is not a safely-derived
53
  pointer value is an invalid pointer value unless the referenced complete
54
  object has previously been declared reachable (
55
+ [[util.dynamic.safety]]).
56
+
57
+ [*Note 1*: The effect of using an invalid pointer value (including
58
+ passing it to a deallocation function) is undefined, see 
59
  [[basic.stc.dynamic.deallocation]]. This is true even if the
60
  unsafely-derived pointer value might compare equal to some
61
+ safely-derived pointer value. *end note*]
62
+
63
+ It is *implementation-defined* whether an implementation has relaxed or
64
+ strict pointer safety.
65