On 22.01.2018 12:22, Richard Hodges via Boost wrote:
It has just occurred to me that the name std::error_code is a misnomer.
What this structure actually represents is *result code* and a domain*.* It has been correctly pointed out that sometimes result codes are not errors (e.g. errno == EINTR during a select())
In hindsight perhaps it should have been called std::result_code(code, std::system_call_domain()).
FWIW, when making my own async IO library in another language, I was inspired by error_code and made something similar. I quickly came to the same conclusion that the name did not accurately reflect the use, and renamed it op_result. I also found the implicit bool conversion was very error prone, as I managed to trip myself a few times when writing examples. So I got rid of it, and introduced an explicit op_result.success() method which does a virtual call to the category. Anyway, just wanted to share. - Asbjørn