From Jason Turner

[propagation]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpnj2yv1sz/{from.md → to.md} +28 -20
tmp/tmpnj2yv1sz/{from.md → to.md} RENAMED
@@ -1,12 +1,12 @@
1
  ### Exception propagation <a id="propagation">[[propagation]]</a>
2
 
3
  ``` cpp
4
- typedef unspecified exception_ptr;
5
  ```
6
 
7
- The type exception_ptr can be used to refer to an exception object.
8
 
9
  `exception_ptr` shall satisfy the requirements of
10
  `NullablePointer` ([[nullablepointer.requirements]]).
11
 
12
  Two non-null values of type `exception_ptr` are equivalent and compare
@@ -16,22 +16,24 @@ The default constructor of `exception_ptr` produces the null value of
16
  the type.
17
 
18
  `exception_ptr` shall not be implicitly convertible to any arithmetic,
19
  enumeration, or pointer type.
20
 
21
- An implementation might use a reference-counted smart pointer as
22
- `exception_ptr`.
23
 
24
  For purposes of determining the presence of a data race, operations on
25
  `exception_ptr` objects shall access and modify only the `exception_ptr`
26
  objects themselves and not the exceptions they refer to. Use of
27
  `rethrow_exception` on `exception_ptr` objects that refer to the same
28
- exception object shall not introduce a data race. if `rethrow_exception`
29
- rethrows the same exception object (rather than a copy), concurrent
30
- access to that rethrown exception object may introduce a data race.
31
- Changes in the number of `exception_ptr` objects that refer to a
32
- particular exception do not introduce a data race.
 
 
33
 
34
  ``` cpp
35
  exception_ptr current_exception() noexcept;
36
  ```
37
 
@@ -41,39 +43,45 @@ handled exception, or a null `exception_ptr` object if no exception is
41
  being handled. The referenced object shall remain valid at least as long
42
  as there is an `exception_ptr` object that refers to it. If the function
43
  needs to allocate memory and the attempt fails, it returns an
44
  `exception_ptr` object that refers to an instance of `bad_alloc`. It is
45
  unspecified whether the return values of two successive calls to
46
- `current_exception` refer to the same exception object. That is, it is
47
- unspecified whether `current_exception` creates a new copy each time it
48
- is called. If the attempt to copy the current exception object throws an
49
- exception, the function returns an `exception_ptr` object that refers to
50
- the thrown exception or, if this is not possible, to an instance of
51
- `bad_exception`. The copy constructor of the thrown exception may also
52
- fail, so the implementation is allowed to substitute a `bad_exception`
53
- object to avoid infinite recursion.
 
 
 
 
 
54
 
55
  ``` cpp
56
  [[noreturn]] void rethrow_exception(exception_ptr p);
57
  ```
58
 
59
  *Requires:* `p` shall not be a null pointer.
60
 
61
- *Throws:* the exception object to which `p` refers.
62
 
63
  ``` cpp
64
  template<class E> exception_ptr make_exception_ptr(E e) noexcept;
65
  ```
66
 
67
  *Effects:* Creates an `exception_ptr` object that refers to a copy of
68
- `e`, as if
69
 
70
  ``` cpp
71
  try {
72
  throw e;
73
  } catch(...) {
74
  return current_exception();
75
  }
76
  ```
77
 
78
- This function is provided for convenience and efficiency reasons.
 
79
 
 
1
  ### Exception propagation <a id="propagation">[[propagation]]</a>
2
 
3
  ``` cpp
4
+ using exception_ptr = unspecified;
5
  ```
6
 
7
+ The type `exception_ptr` can be used to refer to an exception object.
8
 
9
  `exception_ptr` shall satisfy the requirements of
10
  `NullablePointer` ([[nullablepointer.requirements]]).
11
 
12
  Two non-null values of type `exception_ptr` are equivalent and compare
 
16
  the type.
17
 
18
  `exception_ptr` shall not be implicitly convertible to any arithmetic,
19
  enumeration, or pointer type.
20
 
21
+ [*Note 1*: An implementation might use a reference-counted smart
22
+ pointer as `exception_ptr`. — *end note*]
23
 
24
  For purposes of determining the presence of a data race, operations on
25
  `exception_ptr` objects shall access and modify only the `exception_ptr`
26
  objects themselves and not the exceptions they refer to. Use of
27
  `rethrow_exception` on `exception_ptr` objects that refer to the same
28
+ exception object shall not introduce a data race.
29
+
30
+ [*Note 2*: If `rethrow_exception` rethrows the same exception object
31
+ (rather than a copy), concurrent access to that rethrown exception
32
+ object may introduce a data race. Changes in the number of
33
+ `exception_ptr` objects that refer to a particular exception do not
34
+ introduce a data race. — *end note*]
35
 
36
  ``` cpp
37
  exception_ptr current_exception() noexcept;
38
  ```
39
 
 
43
  being handled. The referenced object shall remain valid at least as long
44
  as there is an `exception_ptr` object that refers to it. If the function
45
  needs to allocate memory and the attempt fails, it returns an
46
  `exception_ptr` object that refers to an instance of `bad_alloc`. It is
47
  unspecified whether the return values of two successive calls to
48
+ `current_exception` refer to the same exception object.
49
+
50
+ [*Note 3*: That is, it is unspecified whether `current_exception`
51
+ creates a new copy each time it is called. — *end note*]
52
+
53
+ If the attempt to copy the current exception object throws an exception,
54
+ the function returns an `exception_ptr` object that refers to the thrown
55
+ exception or, if this is not possible, to an instance of
56
+ `bad_exception`.
57
+
58
+ [*Note 4*: The copy constructor of the thrown exception may also fail,
59
+ so the implementation is allowed to substitute a `bad_exception` object
60
+ to avoid infinite recursion. — *end note*]
61
 
62
  ``` cpp
63
  [[noreturn]] void rethrow_exception(exception_ptr p);
64
  ```
65
 
66
  *Requires:* `p` shall not be a null pointer.
67
 
68
+ *Throws:* The exception object to which `p` refers.
69
 
70
  ``` cpp
71
  template<class E> exception_ptr make_exception_ptr(E e) noexcept;
72
  ```
73
 
74
  *Effects:* Creates an `exception_ptr` object that refers to a copy of
75
+ `e`, as if:
76
 
77
  ``` cpp
78
  try {
79
  throw e;
80
  } catch(...) {
81
  return current_exception();
82
  }
83
  ```
84
 
85
+ [*Note 5*: This function is provided for convenience and efficiency
86
+ reasons. — *end note*]
87