Exceptions in C : Should We Specify Them in Function Prototypes?
In C , exception specifiers allow functions to declare whether they may throw exceptions. However, their use has been questioned due to concerns about their effectiveness and consequences.
Reasons Against Using Exception Specifiers:
Reasons to Avoid Exception Specifiers:
Alternatives to Exception Specifiers:
Instead of using exception specifiers, it's generally advisable to:
In conclusion, while exception specifiers provide a mechanism to communicate the potential for exceptions, their limitations and potential negative consequences make them less advisable for general use. By adopting alternative strategies for error handling, developers can enhance the robustness and maintainability of their code.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3