Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove noexcept(false) annotations #159

Closed
etremel opened this issue May 30, 2020 · 4 comments
Closed

Remove noexcept(false) annotations #159

etremel opened this issue May 30, 2020 · 4 comments

Comments

@etremel
Copy link
Contributor

etremel commented May 30, 2020

According to everything I can find on the Internet (such as this and this), the noexcept(false) annotation on a function does nothing. Therefore, we should remove it from the Derecho codebase to reduce unnecessary "noise" in the source code and potential sources of confusion for other developers who use our library (they might wonder why some functions are declared noexcept(false) and some are not, until they figure out that not writing noexcept(false) is exactly the same as writing it).

@songweijia
Copy link
Contributor

I agree to remove noexcept(false) since it does not take effect. I do think C++ should come with a non-parameterized noexcept syntax.

@etremel
Copy link
Contributor Author

etremel commented Jun 3, 2020

Oh, C++ does have a non-parameterized noexcept - if you just write noexcept on a function declaration (with no parentheses) it's exactly equivalent to writing noexcept(true). If you want, I can also change all of our noexcept(true) to noexcept.

@songweijia
Copy link
Contributor

songweijia commented Jun 6, 2020

I'm not sure if you noticed a compilation warning on in commit 4a402b6. Some functions in C++ are by default evaluated to noexcept(true), for example, the destructors. And in such a case, noexcept(false) makes sense.
"""
non-throwing functions are all others (those with noexcept specifier whose expression evaluates to true as well as destructors, defaulted special member functions, and deallocation functions)
"""
Source link. So I reversed one of such a case in 3d6038f.

@etremel
Copy link
Contributor Author

etremel commented Jun 8, 2020

Oh, you're right. I didn't notice the compile warning because our build process produces so much output, but yes, a destructor is one case where declaring noexcept(false) actually has an effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants