21 Jan
2018
21 Jan
'18
10:07 p.m.
On 20/01/2018 07:02, Robert Ramey wrote:
Whether it was intended or not, established practice is to treat the bool conversion of error_code as false==success and true==failure.
It may be established, but it's not good practice. It's an example where implicit conversion SEEMS to make things simpler and more expressive, but it ends up making things more error prone.
How about if it were spelled if (error) instead? While granted this is technically not what the implementation does, it is what most people intend anyway and does work with all standard error_category implementations. The intent does seem far less ambiguous this way, does it not?