Next: Error Handlers, Previous: Error Reporting, Up: Error Handling [Index]
The error code numbers returned by library functions are defined in
the file gsl_errno.h. They all have the prefix GSL_
and
expand to non-zero constant integer values. Error codes above 1024 are
reserved for applications, and are not used by the library. Many of
the error codes use the same base name as the corresponding error code
in the C library. Here are some of the most common error codes,
Domain error; used by mathematical functions when an argument value does not fall into the domain over which the function is defined (like EDOM in the C library)
Range error; used by mathematical functions when the result value is not representable because of overflow or underflow (like ERANGE in the C library)
No memory available. The system cannot allocate more virtual memory
because its capacity is full (like ENOMEM in the C library). This error
is reported when a GSL routine encounters problems when trying to
allocate memory with malloc
.
Invalid argument. This is used to indicate various kinds of problems with passing the wrong argument to a library function (like EINVAL in the C library).
The error codes can be converted into an error message using the
function gsl_strerror
.
This function returns a pointer to a string describing the error code gsl_errno. For example,
printf ("error: %s\n", gsl_strerror (status));
would print an error message like error: output range error
for a
status value of GSL_ERANGE
.
Next: Error Handlers, Previous: Error Reporting, Up: Error Handling [Index]