Re: error handling

John May (johnmay@llnl.gov)
Thu, 22 May 1997 14:28:48 -0700

Marc Snir writes:

[(A) means full elaboration of error handlers and function types
for Comms, Files, and Wins.
(B) means full elaboration of function types but a single error
handler type that keeps track of what kind of handle
it can be attached to.
(C) means a single error handler function type that takes a
void * for a handle pointer and leaves it to the user
to associate the handler with the right kind of handle.
]

> I think we agreed on (B), but there are still some inconsistencies among
> chapters (e.g., do we triplicate MPI_Errhandler_free), and there is still a
> proposal from Squires to go to C. I am not sure that we discussed the
> issue with a clear view of the alternatives and their pros and cons.
> Hence, this mesage.

A pro and a con of C:

Con: since no type checking is possible even at runtime, and since
all error handlers look alike, there is a danger that the user
will, for example, associate the same error handler with all
three kinds of object. This won't be detected until an actual
error occurs and the handler is invoked, at which time the
program will probably crash. This is just what the user wanted
to avoid. Using option A or B allows the user to discover the
sooner.

Pro: perhaps the user *wants* to write one error handler for all
three handles. If the handler ignores the handle passed in, it can
serve all three types of handle.

On balance, I favor B slightly.

John