A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cplusplus.github.io/LWG/issue971 below:

Issue 971: Spurious diagnostic conversion function

This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

971. Spurious diagnostic conversion function

Section: 19.5.4.5 [syserr.errcode.nonmembers] Status: NAD Submitter: Beman Dawes Opened: 2009-01-19 Last modified: 2016-01-28

Priority: Not Prioritized

View all issues with NAD status.

Discussion:

Anthony Williams raised the question in c++std-lib-22987 "why is there std::make_error_code(std::errc)? What purpose does this serve?"

The function make_error_code(errc e) is not required, since make_error_condition(errc e) is the function that is needed for errc conversions. make_error_code(errc e) appears to be a holdover from my initial confusion over the distinction between POSIX and operating systems that conform to the POSIX spec.

[ Post Summit: ]

Recommend Review.

[ Batavia (2009-05): ]

The designer of the facility (Christopher Kohlhoff) strongly disagrees that there is an issue here, and especially disagrees with the proposed resolution. Bill would prefer to be conservative and not apply this proposed resolution. Move to Open, and recommend strong consideration for NAD status.

[ 2009-05-21 Beman adds: ]

My mistake. Christopher and Bill are correct and the issue should be NAD. The function is needed by users.

[ 2009-07-21 Christopher Kohlhoff adds rationale for make_error_code: ]

Users (and indeed library implementers) may need to use the errc codes in portable code. For example:

void do_foo(error_code& ec)
{
#if defined(_WIN32)
  // Windows implementation ...
#elif defined(linux)
  // Linux implementation ...
#else
  // do_foo not supported on this platform
  ec = make_error_code(errc::not_supported);
#endif
}

[ 2009 Santa Cruz: ]

Moved to NAD.

Proposed resolution:

Change System error support 19.5 [syserr], Header <system_error> synopsis, as indicated:

error_code make_error_code(errc e);
error_condition make_error_condition(errc e);

Delete from Class error_code non-member functions 19.5.4.5 [syserr.errcode.nonmembers]:

error_code make_error_code(errc e);

Returns: error_code(static_cast<int>(e), generic_category).


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4