mardi 10 septembre 2019

why default std::error_code does not match default std::error_condition?

As stated in cppreference, the standard specifies that the default constructor for those classes create:

- error_condition { 0, std::generic_category() }
- error_code { 0, std::system_category() }

As std::system_category is required to have a default_error_condition() that matches only the POSIX error codes (also defined in the std::errc enumeration), system:0 does not match generic:0 .

That sounds weird. One would expect that both default constructors match a "no error" condition.

Could this be an error in the standard to be fixed in a further version ?

Aucun commentaire:

Enregistrer un commentaire