Question from the one interview.
Please explain what does this C++ code mean:
void Foo() throw;
Question from the one interview.
Please explain what does this C++ code mean:
void Foo() throw;
void Foo() throw;
is ill-formed.
Instead void Foo() throw();
means that function 'Foo' is declared such that it does not throw any exception
$15.4/10 - "A function with no exception-specification allows all exceptions. A function with an empty exceptionspecification, throw(), does not allow any exceptions."
in an interview, this question provides a good opportunity to talk about exception checking; the differences between C++ and Java; your personal preferences and opinions; a time when exception checking has hurt or helped, etc. It's the kind of question that is not so much about the literally correct single sentence answer that states the syntax rule, but more about an invitation to talk about the way you program and think. Could be dangerous if you pretend to know more than you do, or if your philosophy is very different from theirs.