This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Question on run time error codes
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Date: Mon, 12 Sep 2005 22:37:20 -0700
- Subject: Question on run time error codes
I have been adding some runtime error checks to the arrayio routines and I have
a question.
How do I make an error code accessible at run time as meaningful. For example
if I use IOSTAT=ierr in a write statement, I can test for ierr=13, which is
processor dependent. But if we add an error code, that number may change and
impact previous files.
Are the error names ERROR_WHATEVER accessible at run time by some method?
Is it policy to always add new codes to the end of the list so that all previous
codes are not changed? see example from libgfortran.f where I am adding the
array stride error:
typedef enum
{
ERROR_FIRST = -3, /* Marker for the first error. */
ERROR_EOR = -2,
ERROR_END = -1,
ERROR_OK = 0, /* Indicates success, must be zero. */
ERROR_OS, /* Operating system error, more info in errno. */
ERROR_OPTION_CONFLICT,
ERROR_BAD_OPTION,
ERROR_MISSING_OPTION,
ERROR_ALREADY_OPEN,
ERROR_BAD_UNIT,
ERROR_FORMAT,
ERROR_BAD_ACTION,
ERROR_ENDFILE,
ERROR_BAD_US,
ERROR_READ_VALUE,
ERROR_READ_OVERFLOW,
ERROR_ARRAY_STRIDE,
ERROR_LAST /* Not a real error, the last error # + 1. */
}
error_codes;
Thanks for any suggestions,
Jerry