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

后端 未结 5 1174
暗喜
暗喜 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 06:06

    This is called a throw specification. It defines which exceptions (if any) can be thrown from the function.

    These sound great in theory, but there are issues with using them.

    A good discussion about this can be found at this SO question.

提交回复
热议问题