[comp.lang.fortran] Error handling in large programs

bernhold@red8.qtp.ufl.edu (David E. Bernholdt) (05/29/91)

This is as much a matter of style as anything else, but it is
something that I've seen few books, articles, etc. touch on:

How do you handle errors in large (Fortran) codes?

I know that there are people out there who develop and/or maintain
some pretty complex codes, some of which must have a reasonably large
user base.  So I suspecet that some people have given some thought to
this and come up with various methods for dealing with errors.  How do
_you_ do it, and why?

I'm interested in everything from the grand philosophy to the small
details.  For example:

o  Should subprograms which return error codes be subroutines with the
   error code as one of the arguments, or integer functions which return
   the error code?  

o  What if it is logical for the computational result of a subprogram to
   be returned by a function mechanism -- which gets precedence?

o  Should routines even return error codes, or should they just abort on
   the spot?  Or perhaps they should all call a single error handler --
   such as BLAS-2, BLAS-3, LAPACK calling XERBLA? Or should it return an
   error code to the caller and let the caller do error recovery or
   graceful shutdown if it wants -- possibly all the way back up to the
   main program? 

o  How do you deal with operating systems that don't provide any way to
   print a traceback of the subroutine stack?

o  Do you have different severity levels to warning/error messages?

o  Should all error message be generated by a single routine -- perhaps
   referenced by numeric codes, as many of the unix networking codes tdo
   (see nntp or ftp, for example)?  What about printing of relevant
   variables if you do this?

o  How do these ideas correlate with the level of support you provide for
   the software and/or the  knowledge level of the user community?

o  What references discuss these aspects of programming?

And so on...

I will summarize for the net. Thanks in advance.
-- 
David Bernholdt			bernhold@qtp.ufl.edu
Quantum Theory Project		bernhold@ufpine.bitnet
University of Florida
Gainesville, FL  32611		904/392 6365