From Jason Turner

[basic.stc.dynamic.safety]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpofzn6_lr/{from.md → to.md} +12 -11
tmp/tmpofzn6_lr/{from.md → to.md} RENAMED
@@ -3,21 +3,22 @@
3
  A *traceable pointer object* is
4
 
5
  - an object of an object pointer type ([[basic.compound]]), or
6
  - an object of an integral type that is at least as large as
7
  `std::intptr_t`, or
8
- - a sequence of elements in an array of character type, where the size
9
- and alignment of the sequence match those of some object pointer type.
 
10
 
11
  A pointer value is a *safely-derived pointer* to a dynamic object only
12
  if it has an object pointer type and it is one of the following:
13
 
14
  - the value returned by a call to the C++standard library implementation
15
- of `::operator new(std::size_t)`;[^13]
16
  - the result of taking the address of an object (or one of its
17
- subobjects) designated by an lvalue resulting from dereferencing a
18
- safely-derived pointer value;
19
  - the result of well-defined pointer arithmetic ([[expr.add]]) using a
20
  safely-derived pointer value;
21
  - the result of a well-defined pointer conversion ([[conv.ptr]], 
22
  [[expr.cast]]) of a safely-derived pointer value;
23
  - the result of a `reinterpret_cast` of a safely-derived pointer value;
@@ -44,16 +45,16 @@ at least as large as `std::intptr_t` and it is one of the following:
44
  `reinterpret_cast<void*>(P)`.
45
 
46
  An implementation may have *relaxed pointer safety*, in which case the
47
  validity of a pointer value does not depend on whether it is a
48
  safely-derived pointer value. Alternatively, an implementation may have
49
- *strict pointer safety*, in which case a pointer value that is not a
50
- safely-derived pointer value is an invalid pointer value unless the
51
- referenced complete object is of dynamic storage duration and has
52
- previously been declared reachable ([[util.dynamic.safety]]). the
53
- effect of using an invalid pointer value (including passing it to a
54
- deallocation function) is undefined, see 
55
  [[basic.stc.dynamic.deallocation]]. This is true even if the
56
  unsafely-derived pointer value might compare equal to some
57
  safely-derived pointer value. It is implementation defined whether an
58
  implementation has relaxed or strict pointer safety.
59
 
 
3
  A *traceable pointer object* is
4
 
5
  - an object of an object pointer type ([[basic.compound]]), or
6
  - an object of an integral type that is at least as large as
7
  `std::intptr_t`, or
8
+ - a sequence of elements in an array of narrow character type (
9
+ [[basic.fundamental]]), where the size and alignment of the sequence
10
+ match those of some object pointer type.
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;
22
  - the result of a well-defined pointer conversion ([[conv.ptr]], 
23
  [[expr.cast]]) of a safely-derived pointer value;
24
  - the result of a `reinterpret_cast` of a safely-derived pointer value;
 
45
  `reinterpret_cast<void*>(P)`.
46
 
47
  An implementation may have *relaxed pointer safety*, in which case the
48
  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