3 ms·
I think this is actually an artifact of the 'check the single return value for errors' that requires that the return domain contain at least one error code poin
by convolvatron 4y ago
I think this is actually an artifact of the 'check the single return value for errors' that requires that the return domain contain at least one error code point.
how else you might structure errors without changing much of the rest of C left for an exercise
- amenghra 4y agojust require the programmer to check errno after every function call? /s
- convolvatron 4y agoomg. I forgot about that. the one thing even worse than overloading the return domain.
- kilgnad 4y agoBit my company in the ass recently we uncovered a bug that was causing us to lose 20% of our data for a year. sqlite C libraries apparently still do this. The person who wrote the code was both not very good and had no idea that an error was even occuring.
- Gibbon1 4y agoStrange but true you can create functions where you pass a pointer to an error variable. error_t oops; int x = foo(10, &oops); if(oops) goto whoops; int x = foo(10, 0); // yolo!