Closed smellyfis closed 7 years ago
i'm supposed to be writing a design tomorrow and one of the things i will propose is systematic use of error returns throughout the code.
Yes, absolutely....
Have functions return failure/success. Return the actual output in variables.
double output; if (!get_double(line, &output, log))
Perhaps standardize on passing the log object last.
Also all memory allocation functions exit() on error. I suggest returning NULL and logging what went wrong.
functions in spline.c are void and rely on exit(1) should return int that indicate status
In issue #3 I changed all the functions that call *alloc in alloc_fctns.c to return NULL on failure but I did not put checks on the return value. I think there is a warning flag in either gcc or clang that will warn on unchecked return values.
These functions are no longer used therefore this issue can be closed
in string_fctns.c get_int and get_double used to use longjmp function error_return to exit in case of bad number but now that it will be removed these functions will always return a result.