what does this declaration mean? exception() throw()

后端 未结 5 1206
暗喜
暗喜 2021-01-12 05:34

std::exception class is defined as follows

exception() throw() { }
virtual ~exception() throw();
virtual const char* what() const throw();

5条回答
  •  温柔的废话
    2021-01-12 05:55

    Without any parameter, it means that the mentioned functions does not throw any exceptions.

    If you specify anything as a parameter, you're saying that the function will throw only exceptions of that type. Notice, however, this is not an enforcement to the compiler. If an exception of some other type happens to be thrown the program will call std::terminate().

提交回复
热议问题