From Jason Turner

[std.exceptions]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp7vk5xg5c/{from.md → to.md} +21 -19
tmp/tmp7vk5xg5c/{from.md → to.md} RENAMED
@@ -1,8 +1,8 @@
1
  ## Exception classes <a id="std.exceptions">[[std.exceptions]]</a>
2
 
3
- The Standard C++library provides classes to be used to report certain
4
  errors ([[res.on.exception.handling]]) in C++programs. In the error
5
  model reflected in these classes, errors are divided into two broad
6
  categories: *logic* errors and *runtime* errors.
7
 
8
  The distinguishing characteristic of logic errors is that they are due
@@ -13,10 +13,12 @@ By contrast, runtime errors are due to events beyond the scope of the
13
  program. They cannot be easily predicted in advance. The header
14
  `<stdexcept>` defines several types of predefined exceptions for
15
  reporting errors in a C++program. These exceptions are related by
16
  inheritance.
17
 
 
 
18
  ``` cpp
19
  namespace std {
20
  class logic_error;
21
  class domain_error;
22
  class invalid_argument;
@@ -49,19 +51,19 @@ as violations of logical preconditions or class invariants.
49
  logic_error(const string& what_arg);
50
  ```
51
 
52
  *Effects:* Constructs an object of class `logic_error`.
53
 
54
- `strcmp(what(), what_arg.c_str()) == 0`.
55
 
56
  ``` cpp
57
  logic_error(const char* what_arg);
58
  ```
59
 
60
  *Effects:* Constructs an object of class `logic_error`.
61
 
62
- `strcmp(what(), what_arg) == 0`.
63
 
64
  ### Class `domain_error` <a id="domain.error">[[domain.error]]</a>
65
 
66
  ``` cpp
67
  namespace std {
@@ -80,19 +82,19 @@ exceptions by the implementation to report domain errors.
80
  domain_error(const string& what_arg);
81
  ```
82
 
83
  *Effects:* Constructs an object of class `domain_error`.
84
 
85
- `strcmp(what(), what_arg.c_str()) == 0`.
86
 
87
  ``` cpp
88
  domain_error(const char* what_arg);
89
  ```
90
 
91
  *Effects:* Constructs an object of class `domain_error`.
92
 
93
- `strcmp(what(), what_arg) == 0`.
94
 
95
  ### Class `invalid_argument` <a id="invalid.argument">[[invalid.argument]]</a>
96
 
97
  ``` cpp
98
  namespace std {
@@ -111,19 +113,19 @@ exceptions to report an invalid argument.
111
  invalid_argument(const string& what_arg);
112
  ```
113
 
114
  *Effects:* Constructs an object of class `invalid_argument`.
115
 
116
- `strcmp(what(), what_arg.c_str()) == 0`.
117
 
118
  ``` cpp
119
  invalid_argument(const char* what_arg);
120
  ```
121
 
122
  *Effects:* Constructs an object of class `invalid_argument`.
123
 
124
- `strcmp(what(), what_arg) == 0`.
125
 
126
  ### Class `length_error` <a id="length.error">[[length.error]]</a>
127
 
128
  ``` cpp
129
  namespace std {
@@ -143,19 +145,19 @@ exceeds its maximum allowable size.
143
  length_error(const string& what_arg);
144
  ```
145
 
146
  *Effects:* Constructs an object of class `length_error`.
147
 
148
- `strcmp(what(), what_arg.c_str()) == 0`.
149
 
150
  ``` cpp
151
  length_error(const char* what_arg);
152
  ```
153
 
154
  *Effects:* Constructs an object of class `length_error`.
155
 
156
- `strcmp(what(), what_arg) == 0`.
157
 
158
  ### Class `out_of_range` <a id="out.of.range">[[out.of.range]]</a>
159
 
160
  ``` cpp
161
  namespace std {
@@ -174,19 +176,19 @@ exceptions to report an argument value not in its expected range.
174
  out_of_range(const string& what_arg);
175
  ```
176
 
177
  *Effects:* Constructs an object of class `out_of_range`.
178
 
179
- `strcmp(what(), what_arg.c_str()) == 0`.
180
 
181
  ``` cpp
182
  out_of_range(const char* what_arg);
183
  ```
184
 
185
  *Effects:* Constructs an object of class `out_of_range`.
186
 
187
- `strcmp(what(), what_arg) == 0`.
188
 
189
  ### Class `runtime_error` <a id="runtime.error">[[runtime.error]]</a>
190
 
191
  ``` cpp
192
  namespace std {
@@ -206,19 +208,19 @@ executes.
206
  runtime_error(const string& what_arg);
207
  ```
208
 
209
  *Effects:* Constructs an object of class `runtime_error`.
210
 
211
- `strcmp(what(), what_arg.c_str()) == 0`.
212
 
213
  ``` cpp
214
  runtime_error(const char* what_arg);
215
  ```
216
 
217
  *Effects:* Constructs an object of class `runtime_error`.
218
 
219
- `strcmp(what(), what_arg) == 0`.
220
 
221
  ### Class `range_error` <a id="range.error">[[range.error]]</a>
222
 
223
  ``` cpp
224
  namespace std {
@@ -237,19 +239,19 @@ to report range errors in internal computations.
237
  range_error(const string& what_arg);
238
  ```
239
 
240
  *Effects:* Constructs an object of class `range_error`.
241
 
242
- `strcmp(what(), what_arg.c_str()) == 0`.
243
 
244
  ``` cpp
245
  range_error(const char* what_arg);
246
  ```
247
 
248
  *Effects:* Constructs an object of class `range_error`.
249
 
250
- `strcmp(what(), what_arg) == 0`.
251
 
252
  ### Class `overflow_error` <a id="overflow.error">[[overflow.error]]</a>
253
 
254
  ``` cpp
255
  namespace std {
@@ -268,19 +270,19 @@ exceptions to report an arithmetic overflow error.
268
  overflow_error(const string& what_arg);
269
  ```
270
 
271
  *Effects:* Constructs an object of class `overflow_error`.
272
 
273
- `strcmp(what(), what_arg.c_str()) == 0`.
274
 
275
  ``` cpp
276
  overflow_error(const char* what_arg);
277
  ```
278
 
279
  *Effects:* Constructs an object of class `overflow_error`.
280
 
281
- `strcmp(what(), what_arg) == 0`.
282
 
283
  ### Class `underflow_error` <a id="underflow.error">[[underflow.error]]</a>
284
 
285
  ``` cpp
286
  namespace std {
@@ -299,15 +301,15 @@ exceptions to report an arithmetic underflow error.
299
  underflow_error(const string& what_arg);
300
  ```
301
 
302
  *Effects:* Constructs an object of class `underflow_error`.
303
 
304
- `strcmp(what(), what_arg.c_str()) == 0`.
305
 
306
  ``` cpp
307
  underflow_error(const char* what_arg);
308
  ```
309
 
310
  *Effects:* Constructs an object of class `underflow_error`.
311
 
312
- `strcmp(what(), what_arg) == 0`.
313
 
 
1
  ## Exception classes <a id="std.exceptions">[[std.exceptions]]</a>
2
 
3
+ The C++standard library provides classes to be used to report certain
4
  errors ([[res.on.exception.handling]]) in C++programs. In the error
5
  model reflected in these classes, errors are divided into two broad
6
  categories: *logic* errors and *runtime* errors.
7
 
8
  The distinguishing characteristic of logic errors is that they are due
 
13
  program. They cannot be easily predicted in advance. The header
14
  `<stdexcept>` defines several types of predefined exceptions for
15
  reporting errors in a C++program. These exceptions are related by
16
  inheritance.
17
 
18
+ ### Header `<stdexcept>` synopsis <a id="stdexcept.syn">[[stdexcept.syn]]</a>
19
+
20
  ``` cpp
21
  namespace std {
22
  class logic_error;
23
  class domain_error;
24
  class invalid_argument;
 
51
  logic_error(const string& what_arg);
52
  ```
53
 
54
  *Effects:* Constructs an object of class `logic_error`.
55
 
56
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
57
 
58
  ``` cpp
59
  logic_error(const char* what_arg);
60
  ```
61
 
62
  *Effects:* Constructs an object of class `logic_error`.
63
 
64
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
65
 
66
  ### Class `domain_error` <a id="domain.error">[[domain.error]]</a>
67
 
68
  ``` cpp
69
  namespace std {
 
82
  domain_error(const string& what_arg);
83
  ```
84
 
85
  *Effects:* Constructs an object of class `domain_error`.
86
 
87
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
88
 
89
  ``` cpp
90
  domain_error(const char* what_arg);
91
  ```
92
 
93
  *Effects:* Constructs an object of class `domain_error`.
94
 
95
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
96
 
97
  ### Class `invalid_argument` <a id="invalid.argument">[[invalid.argument]]</a>
98
 
99
  ``` cpp
100
  namespace std {
 
113
  invalid_argument(const string& what_arg);
114
  ```
115
 
116
  *Effects:* Constructs an object of class `invalid_argument`.
117
 
118
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
119
 
120
  ``` cpp
121
  invalid_argument(const char* what_arg);
122
  ```
123
 
124
  *Effects:* Constructs an object of class `invalid_argument`.
125
 
126
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
127
 
128
  ### Class `length_error` <a id="length.error">[[length.error]]</a>
129
 
130
  ``` cpp
131
  namespace std {
 
145
  length_error(const string& what_arg);
146
  ```
147
 
148
  *Effects:* Constructs an object of class `length_error`.
149
 
150
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
151
 
152
  ``` cpp
153
  length_error(const char* what_arg);
154
  ```
155
 
156
  *Effects:* Constructs an object of class `length_error`.
157
 
158
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
159
 
160
  ### Class `out_of_range` <a id="out.of.range">[[out.of.range]]</a>
161
 
162
  ``` cpp
163
  namespace std {
 
176
  out_of_range(const string& what_arg);
177
  ```
178
 
179
  *Effects:* Constructs an object of class `out_of_range`.
180
 
181
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
182
 
183
  ``` cpp
184
  out_of_range(const char* what_arg);
185
  ```
186
 
187
  *Effects:* Constructs an object of class `out_of_range`.
188
 
189
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
190
 
191
  ### Class `runtime_error` <a id="runtime.error">[[runtime.error]]</a>
192
 
193
  ``` cpp
194
  namespace std {
 
208
  runtime_error(const string& what_arg);
209
  ```
210
 
211
  *Effects:* Constructs an object of class `runtime_error`.
212
 
213
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
214
 
215
  ``` cpp
216
  runtime_error(const char* what_arg);
217
  ```
218
 
219
  *Effects:* Constructs an object of class `runtime_error`.
220
 
221
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
222
 
223
  ### Class `range_error` <a id="range.error">[[range.error]]</a>
224
 
225
  ``` cpp
226
  namespace std {
 
239
  range_error(const string& what_arg);
240
  ```
241
 
242
  *Effects:* Constructs an object of class `range_error`.
243
 
244
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
245
 
246
  ``` cpp
247
  range_error(const char* what_arg);
248
  ```
249
 
250
  *Effects:* Constructs an object of class `range_error`.
251
 
252
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
253
 
254
  ### Class `overflow_error` <a id="overflow.error">[[overflow.error]]</a>
255
 
256
  ``` cpp
257
  namespace std {
 
270
  overflow_error(const string& what_arg);
271
  ```
272
 
273
  *Effects:* Constructs an object of class `overflow_error`.
274
 
275
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
276
 
277
  ``` cpp
278
  overflow_error(const char* what_arg);
279
  ```
280
 
281
  *Effects:* Constructs an object of class `overflow_error`.
282
 
283
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
284
 
285
  ### Class `underflow_error` <a id="underflow.error">[[underflow.error]]</a>
286
 
287
  ``` cpp
288
  namespace std {
 
301
  underflow_error(const string& what_arg);
302
  ```
303
 
304
  *Effects:* Constructs an object of class `underflow_error`.
305
 
306
+ *Postconditions:* `strcmp(what(), what_arg.c_str()) == 0`.
307
 
308
  ``` cpp
309
  underflow_error(const char* what_arg);
310
  ```
311
 
312
  *Effects:* Constructs an object of class `underflow_error`.
313
 
314
+ *Postconditions:* `strcmp(what(), what_arg) == 0`.
315