On 01/12/18 18:43, Niall Douglas via Boost wrote:
2. Success becomes solely the default constructed error code, which is code zero and a new category of "null_category". This is internally represented by { 0, nullptr }, and thus makes the default constructor trivial which is highly desirable as it eliminates any compiler magic static fencing for the default constructor. Right now the default constructor uses system_category with value 0, and I suspect no code will notice this change either.
Does this mean that custom error categories have to change their make_error_code(e) function to either return a default constructed error_code in case the error value indicates success, or a custom error_code otherwise? In other words, today we do this: namespace my { std::error_code make_error_code(my::errc e) { return std::error(e, my::category()); } } Should that be changed to this? namespace my { std::error_code make_error_code(my::errc e) { if (e == my::success) return std::error_code(); return std::error_code(e, my::category); } }