Document number: N3156=10-0146
Date: 2010-10-14
J. Daniel Garcia
Project: Programming Language C++, Library Working Group
Reply To: josedaniel.garcia@uc3m.es

N3156 - More on noexcept for the diagnostics library

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.

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

Discussion

Class error_category

Destructor should not throw and has been made noexcept.

Operators == and != for error categories cannot throw as they are specified to return pointer comparisons which cannot throw.

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

Class error_code

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

Function make_error_code() is based on non-throwing operations. This paper proposes making it noexcept.

Class error_condition

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

Function make_error_condition() is based on non-throwing operations. This paper proposes making it noexcept.

Acknowledgments

Daniel Krügler and Beman Dawes provided very useful information for this paper.

Proposed Wording

19.5 System error support

After p. 2
namespace std {
...
  error_code make_error_code(errc e) noexcept;
  error_condition make_error_condition(errc e) noexcept;
...
}

19.5.1.1 Class error_category overview

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

19.5.1.3 Class error_category non-virtual members

Before p. 1
bool operator==(const error_category& rhs) const noexcept;
After p. 1
bool operator!=(const error_category& rhs) const noexcept;

19.5.1.5 Error category objects

Before p. 1
const error_category& generic_category() noexcept;
After p. 2
const error_category& system_category() noexcept;

19.5.2.1 Class error_code overview

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

19.5.2.5 Class error_code non-member functions

Before p. 1
error_code make_error_code(errc e) noexcept;

19.5.2.3 Class error_code modifiers

After p. 6
void clear() noexcept;

19.5.3.1 Class error_condition overview

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

19.5.3.3 Class error_condition modifiers

After p. 6
void clear() noexcept;

19.5.3.5 Class error_condition non-member functions

Before p. 1
error_condition make_error_condition(errc e) noexcept;