Question from the one interview.
Please explain what does this C++ code mean:
void Foo() throw;
void Foo() throw;
This is a syntax error. The grammar for exception specification (C++98 §15.4) is:
exception-specification:
throw
(
type-id-listopt)
Note that the parenthesis are required.
On the other hand,
void Foo() throw();
means the function Foo()
will not throw any exceptions.