What is the point of `void func() throw(type)`?

前端 未结 6 1455
星月不相逢
星月不相逢 2020-12-18 11:59

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 &l         


        
6条回答
  •  南笙
    南笙 (楼主)
    2020-12-18 12:42

    Exception specification. The type(s) following the throw keyword specifies exactly what all, if any, exceptions the function can throw. See 15.4 of the draft.

    Note: A function with no exception-specification allows all exceptions. A function with an empty exception-specification, throw(), does not allow any exceptions.

提交回复
热议问题