Title
Spurious diagnostic conversion function
Status
nad
Section
[syserr.errcode.nonmembers]
Submitter
Beman Dawes

Created on 2009-01-19.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Change System error support [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 [syserr.errcode.nonmembers]:

error_code make_error_code(errc e);

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

Date: 2010-10-21.18:28:33

[ 2009 Santa Cruz: ]

Moved to NAD.

Date: 2009-07-21.00:00:00

[ 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
}
Date: 2009-05-21.00:00:00

[ 2009-05-21 Beman adds: ]

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

Date: 2010-10-21.18:28:33

[ 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.

Date: 2010-10-21.18:28:33

[ Post Summit: ]

Recommend Review.

Date: 2009-01-19.00:00:00

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.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg4623
2010-10-21 18:28:33adminsetmessages: + msg4622
2010-10-21 18:28:33adminsetmessages: + msg4621
2010-10-21 18:28:33adminsetmessages: + msg4620
2010-10-21 18:28:33adminsetmessages: + msg4619
2010-10-21 18:28:33adminsetmessages: + msg4618
2009-01-19 00:00:00admincreate