You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Mark Whitlock <ma...@uk.ibm.com> on 2005/05/04 14:20:20 UTC

throw in method signatures




Some methods have throw( <list of exceptions> ) in their signature and some
do not. Unlike Java, the compiler allows an exception not in the list to be
thrown from within such a method, but this causes the unexpected() handler
to be driven which causes a coredump. So making a method throw a different
exception, may make a method further up the stack coredump (if it doesn't
have the new exception in its thrown exception list). If some methods have
thrown exception lists in their signature and some do not, this increases
the chances of such coredumps, since the effects of throwing a different
exception will be less obvious (until it fails at runtime).

So I propose that we do not put thrown exception lists in method
signatures.

Maybe it would be better to put thrown exception lists on *every* method,
if some compiler would give warnings about "method throwing an exception
not in the thrown exception list". But I'm not aware that any compiler
does. Unless anyone knows different?

What do you think?
Mark
Mark Whitlock
IBM