"Wat" <welwat@hotmail.com> wrote...
1. Is this correct in C++?
int foo() throw(); // can not throw any exception
Yes.
int foo(); // can throw any exception
Yes.
2. Exception specification:
int foo() throw(type list);
For example, void foo() throw(int, over_flow);
Should two catch blocks built to catch "int" and "over_flow" separately?
Or
just one block of catch, which catches both "int" and "over_flow"?
There is no way in one catch block to catch two different types, unless
they are related classes and _the_base_one_ is caught by a reference or
a pointer.
3. If "int foo() throw();" does mean "can not throw any exception", then
what happens if an exception do occur inside foo()?
'unexpected()' is called.
4. Does the above exception specification also apply to memeber functions
of
classes?
Of course.
V
.