[LLVMdev] r212408 - Update for llvm api change.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jul 7 05:47:25 PDT 2014


> And it's no longer possible to do if (std::error_code EC = ...) which makes
> error-checking an explicit step that's easy to forget.

Quite the opposite. The main advantage of ErrorOr is that it makes
error checking mandatory. Whet EC is the return type, it is possible
to not check it and access the "actual return" type. With ErrorOr
there is an assert that prevents one from getting the value if there
is an error_code instead.

That is true for any value returning function, but without c++11
ErrorOr<move-only-type> was too cumbersome to use, which is not longer
the case.

Cheers,
Rafael



More information about the llvm-dev mailing list