[llvm-dev] [RFC] Error handling in LLVM libraries.
James Y Knight via llvm-dev
llvm-dev at lists.llvm.org
Wed Feb 3 07:40:52 PST 2016
On Tue, Feb 2, 2016 at 9:23 PM, Lang Hames <lhames at gmail.com> wrote:
> I see the attribute as complimentary. The runtime check provides a
> stronger guarantee: the error cannot be dropped on any path, rather than
> just "the result is used". The attribute can help you catch obvious
> violations of this at compile time.
>
I agree the runtime check *can* catch something additional, it just doesn't
feel to me like the extra complexity has been justified.
Or, at least, I'd have imagined a much simpler and straightforward
interface would be fully sufficient. E.g., instead of the all the
catch/handle stuff, if you want to handle a particular class specially, how
about just using an if?
TypedError err = somethingThatCanFail();
if (err) {
if (err.isClassOf(...)) {
whatever;
else
return err;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160203/4e0aa501/attachment.html>
More information about the llvm-dev
mailing list