﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>N3156 - More on noexcept for the diagnostics library</title>

  <style type="text/css">
    p {text-align:justify}
    li {text-align:justify}
    ins {background-color:#A0FFA0}
    del {background-color:#FF6666}
    
    tr.TITLE_ROW {text-align: center; font-weight: bold}
    tr.DELETED {background: #FF6666; text-decoration: line-through}
    tr.INSERTED {background: #FFFF99}
  </style>

  </head>

  <body>
<address>Document number: N3156=10-0146<br/>
  Date: 2010-10-14<br/>
  J. Daniel Garcia<br/>
  Project: Programming Language C++, Library Working Group<br />
  Reply To: <a href="mailto:josedaniel.garcia@uc3m.es">josedaniel.garcia@uc3m.es</a>
</address>
 
<hr/>

<h1>N3156 - More on noexcept for the diagnostics library</h1>

<p>During the Rapperswil meeting the Library Working Group decided to revise the library in terms of no except.
This paper presents proposed wording for some of these changes. The paper addresses National Body comments 
CH 16 and GB 60.</p>

<p>
This paper poposes additional changes to those presented in N3148 and N3149. Changes in this paper are
<b>restricted to chapter 19</b> (diagnostics library).
</p>

<h2>Discussion</h2>

<h3>Class error_category</h3>

<p>Destructor should not throw and has been made <tt>noexcept</tt>.</p>

<p>
Operators <tt>==</tt> and <tt>!=</tt> for error categories cannot throw as they are specified to return pointer 
comparisons which cannot throw.
</p>

<p>Functions for access to error category objects return a reference to a single objects. They have been specified
as <tt>noexcept</tt> as they cannot throw.</p>

<h3>Class error_code</h3>

<p>Member function <tt>clear()</tt> is specified to establish the value and category pointer. None of those operations
can throw. This paper proposes making <tt>clear()</tt> non-throwing.</p>

<p>Function <tt>make_error_code()</tt> is based on non-throwing operations. This paper proposes making it <tt>noexcept</tt>.

<h3>Class error_condition</h3>

<p>Member function <tt>clear()</tt> is specified to establish the value and category pointer. None of those operations
can throw. This paper proposes making <tt>clear()</tt> non-throwing.</p>

<p>Function <tt>make_error_condition()</tt> is based on non-throwing operations. This paper proposes making it 
<tt>noexcept</tt>.

<h2>Acknowledgments</h2>

Daniel Kr&uuml;gler and Beman Dawes provided very useful information for this paper.

<h1>Proposed Wording</h1>

<h2>19.5 System error support</h2>

After p. 2
<pre>
namespace std {
...
  error_code make_error_code(errc e)<ins> noexcept</ins>;
  error_condition make_error_condition(errc e)<ins> noexcept</ins>;
...
}
</pre>

<h2>19.5.1.1 Class error_category overview</h2>

After p. 1
<pre>
namespace std {
  class error_category {
  public:
    virtual ~error_category()<ins> noexcept</ins>;
...
    bool operator==(const error_category&amp; rhs) const<ins> noexcept</ins>;
    bool operator!=(const error_category&amp; rhs) const<ins> noexcept</ins>;
...
  };
  const error_category&amp; generic_category()<ins> noexcept</ins>;
  const error_category&amp; system_category()<ins> noexcept</ins>;
} // namespace std
</pre>

<h2>19.5.1.3 Class error_category non-virtual members</h2>

Before p. 1
<pre>bool operator==(const error_category&amp; rhs) const<ins> noexcept</ins>;</pre>

After p. 1
<pre>bool operator!=(const error_category&amp; rhs) const<ins> noexcept<ins>;</pre>

<h2>19.5.1.5 Error category objects</h2>

Before p. 1
<pre>const error_category&amp; generic_category()<ins> noexcept</ins>;</pre>

After p. 2
<pre>const error_category&amp; system_category()<ins> noexcept</ins>;</pre>

<h2>19.5.2.1 Class error_code overview</h2>

After p. 1
<pre>
namespace std {
  class error_code {
  public:
...
    void clear()<ins> noexcept</ins>;
...
  };
} // namespace std
</pre>

<h2>19.5.2.5 Class error_code non-member functions</h2>

Before p. 1
<pre>error_code make_error_code(errc e)<ins> noexcept</ins>;</pre>

<h2>19.5.2.3 Class error_code modifiers</h2>

After p. 6
<pre>void clear()<ins> noexcept</ins>;</pre>

<h2>19.5.3.1 Class error_condition overview</h2>

After p. 1
<pre>
namespace std {
  class error_condition {
  public:
...
    void clear()<ins> noexcept</ins>;
  };
} //namespace std
</pre>

<h2>19.5.3.3 Class error_condition modifiers</h2>

After p. 6
<pre>void clear()<ins> noexcept</ins>;</pre>

<h2>19.5.3.5 Class error_condition non-member functions</h2>

Before p. 1
<pre>error_condition make_error_condition(errc e)<ins> noexcept</ins>;</pre>


</body>
</html>
