[llvm-dev] Exceptions and performance
Sterling Augustine via llvm-dev
llvm-dev at lists.llvm.org
Thu Aug 13 16:58:29 PDT 2020
On Thu, Aug 13, 2020 at 4:38 PM Haoran Xu <haoranxu510 at gmail.com> wrote:
> I think if a function could throw, then it *should* return an error code
> in the no-except approach, otherwise there would be no way to convey the
> error to caller.
>
And here is the rub. What a function *should* do, and what it is required
to do by the standard (and therefore what the the compiler can rely on),
are very different things.
> Am I missing some piece?
>
I think the thing you are missing is what the compiler *actually* knows and
can prove, versus what it might know if the code is well structured. (Most
code is not well structured.)
What does the standard say the following function could possibly return?
What type will the error be?
void Foo();
Now, according to the standard, what exceptions can it throw, and what are
the possible types of those exceptions?
Remember, we are talking about what the compiler can actually prove.
Anyway, I won't get into this further.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200813/a0c93cb1/attachment-0001.html>
More information about the llvm-dev
mailing list