I have a member function that doesn't throw anything so i appended the throw()
suffix to the end of it, indicating that it won't throw any exceptions.
My question is, in the function I make use of several std::string
, and lets say something goes wrong in the initialization of the std::string
, and it throws bad_alloc
or out_of_range
(or what ever else can go wrong with a std::string).
Is it still safe to still add the throw()
suffix?
Herb Sutter says that
exception specifications confer a lot less benefit than they're worth
It can cause more problems than bring benefits. So, you should think twise before doing that.
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