• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1+++
2title = "Approximate map between error code designs"
3weight = 10
4+++
5
6Much of the design of Boost.System (which went on to become `<system_error>`)
7has been retained in proposed `<system_error2>`, so an approximate map between
8`<system_error2>` and `<system_error>` and Boost.System can be given:
9
10<table width="100%" cellpadding="5" border="1">
11<colgroup>
12 <col width="25%">
13 <col width="25%">
14 <col width="50%">
15</colgroup>
16<tr><th>C++ 17 <tt>&lt;system_error&gt;</tt><th>Boost.System<th>Proposed <tt>&lt;system_error2&gt;</tt>
17<tr>
18 <td style="vertical-align: top;"><tt>std::errc</tt>
19 <td style="vertical-align: top;"><tt>boost::system::errc</tt>
20 <td style="vertical-align: top;"><tt>experimental::errc</tt> (almost identical)
21<tr>
22 <td style="vertical-align: top;"><tt>std::error_category</tt>
23 <td style="vertical-align: top;"><tt>boost::system::error_category</tt>
24 <td style="vertical-align: top;"><tt>experimental::status_code_domain</tt>
25<tr>
26 <td style="vertical-align: top;"><tt>std::generic_category</tt>
27 <td style="vertical-align: top;"><tt>boost::system::generic_category</tt>
28 <td style="vertical-align: top;"><tt>experimental::generic_code_domain</tt>
29<tr>
30 <td style="vertical-align: top;"><tt>std::system_category</tt>
31 <td style="vertical-align: top;"><tt>boost::system::system_category</tt>
32 <td style="vertical-align: top;">One of:<ul>
33  <li><tt>experimental::posix_code_domain</tt> (POSIX systems)<p>
34  <li><tt>experimental::win32_code_domain</tt> (Microsoft Windows)<p>
35  <li><tt>experimental::nt_code_domain</tt> (Microsoft Windows)
36 </ul>
37<tr>
38 <td style="vertical-align: top;"><tt>std::error_condition</tt>
39 <td style="vertical-align: top;"><tt>boost::system::error_condition</tt>
40 <td style="vertical-align: top;"><b>No equivalent</b> (deliberately removed as hindsight proved it to be a design mistake leading to much confusing and hard to audit for correctness code)
41<tr>
42 <td style="vertical-align: top;"><tt>std::error_code</tt>
43 <td style="vertical-align: top;"><tt>boost::system::error_code</tt>
44 <td style="vertical-align: top;">One of:<ul>
45  <li><tt>experimental::status_code&lt;DomainType&gt;</tt><p>
46  <li><tt>const experimental::status_code&lt;void&gt; &amp;</tt><p>
47  <li><tt>experimental::status_code&lt;erased&lt;intptr_t&gt;&gt;</tt> (aliased to <tt>experimental::system_code</tt>)<p>
48  <li><tt>experimental::errored_status_code&lt;DomainType&gt;</tt><p>
49  <li><tt>const experimental::errored_status_code&lt;void&gt; &amp;</tt><p>
50  <li><tt>experimental::errored_status_code&lt;erased&lt;intptr_t&gt;&gt;</tt> (aliased to <tt>experimental::error</tt>)
51 </ul>
52<tr>
53 <td style="vertical-align: top;"><tt>std::system_error</tt>
54 <td style="vertical-align: top;"><tt>boost::system::system_error</tt>
55 <td style="vertical-align: top;">One of:<ul>
56  <li><tt>const experimental::status_error&lt;void&gt; &amp;</tt><p>
57  <li><tt>experimental::status_error&lt;DomainType&gt;</tt>
58 </ul>
59</table>
60
61As is obvious from the above, in `<system_error2>` one must be much more specific and accurate
62with respect to intent and specification and desired semantics than with `<system_error>`. Much
63ambiguity and incorrectness which flies silently in `<system_error>` will
64refuse to compile in `<system_error2>`.
65