3 ms·
Yes, 100%! This is exactly the machinery the makes it hard for a compiler to elide the exception. I don’t think there’s anything in the standard that prevents
by vgatherps 4y ago
Yes, 100%! This is exactly the machinery the makes it hard for a compiler to elide the exception.
I don’t think there’s anything in the standard that prevents the compiler from optimizing away said exception completely, but neither gcc or clang do so even in extremely trivial cases where the exception is identical to an if statement:
https://godbolt.org/z/8Y81bzo5s https://godbolt.org/z/8Y81bzo5s