Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: