What is the point of `void func() throw(type)`?
问题 I know this is a valid c++ program. What is the point of the throw in the function declarement? AFAIK it does nothing and isnt used for anything. #include <exception> void func() throw(std::exception) { } int main() { return 0; } 回答1: That is an exception specification, and it is almost certainly a bad idea. It states that func may throw a std::exception , and any other exception that func emits will result in a call to unexpected(). 回答2: It specifies that any std::exception can be thrown