glouw/tinn

Completion of error handling

elfring opened this issue · 15 comments

Would you like to add more error handling for return values from functions like the following?

glouw commented

I'll take a handle for xtload() for fopen. Not too concerned with calloc or fopen for writes failing.

I suggest to avoid ignorance of return values a bit more.
Would you like to detect every error situation as early as possible?

glouw commented

A little overkill in my opinion

I prefer a more complete error detection and exception handling.

glouw commented

Okay, I'll pop in ecalloc() and efopen() wrappers

glouw commented

assertations for callocs and fopens were added instead

glouw commented

actually, now that I think about it, asserts can be disabled globally. efopen and ecalloc were added instead.

glouw commented

scanf you mean? I'll patch it

Functions like fclose() and fprintf() will need also further software development attention, won't they?

glouw commented

No, assuming that efopen() was successful, fclose() and fprintf() can be used without worry.

Your assumptions are questionable in this case. There are additional failure possibilities to consider.

How do you think about to improve static source code analysis also for your software?

glouw commented

I rely on runtime analysis with valgrind. Static analysis is typically overkill at times. The metrics supplied by gcc's -Wall and -Wextra is usually enough.

Would you like to extend the development methodology with any software tools?

glouw commented

Developments done for the most part as this is a practice in minimalism, If you're looking for a fully developed neural net library then checkout FANN (https://github.com/libfann/fann).