interim icon indicating copy to clipboard operation
interim copied to clipboard

Completion of error handling

Open elfring opened this issue 9 years ago • 4 comments

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

elfring avatar Sep 16 '15 17:09 elfring

I don't really understand what this issue is exactly about, sorry. Please rephrase.

mntmn avatar Sep 20 '15 18:09 mntmn

I think it means that the call to seek in posixfs_open doesn't check the return code and same for malloc in main and printf in init_compiler

jeapostrophe avatar Sep 21 '15 01:09 jeapostrophe

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

elfring avatar Sep 21 '15 06:09 elfring

Personally, I believe that error checking printf is a tad overkill, with snprintf however a must. Perhaps malloc could be replaced with something like xmalloc (which exits if malloc threw an error because, well, there isn't much else you can do in that situation).

Other than that, more error handling in file and string functions would be great and if possible/sensible, the use of safer string functions. There's at least one occurrence of improperly null-terminated strings in the sources, for that pervasive use of snprintf would be a good idea (combined with a warning if the limit is exceeded). I'll have to investigate what the situation with strlen, strcpy and strcmp is.

wasamasa avatar Mar 15 '17 12:03 wasamasa