I know that this feature will be deprecated in C++0x, but for me as a total novice it seems like a good idea to have it. Could anyone explain to me why isn't a good idea?
Explanation: C++ provides a mechanism to ensure that a given function is limited to throwing only a specified list of exceptions. It is called an exception specification.
If a catch block cannot handle the particular exception it has caught, you can rethrow the exception. The rethrow expression ( throw without assignment_expression) causes the originally thrown object to be rethrown.
The noexcept operator performs a compile-time check that returns true if an expression is declared to not throw any exceptions. It can be used within a function template's noexcept specifier to declare that the function will throw exceptions for some types but not others.
Please see this detailed article by Herb Sutter. He has the most thorough explanation of the problems and short comings of their design.
A Pragmatic Look at Exception Specificiations
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With