New answers tagged idioms
No. There is nothing idiomatic about error-handling-by-return-value, either in the callee side or the caller. Leave these terrible practices in the Stone Age where they belong. You should write your functions to throw on failure. If you're using a library that hasn't been updated since 1972, then you need to wrap it to provide a usable interface.
Is checking return values always required? I don't think so; rather, they are almost always required. Proper error checking is very important, although sometimes it can admittedly be a pain in the neck. However, your particular example does not describe a typical "perform operation that may fail and check the error" scenario. If your assumption about ...
That depends upon what you mean. If you mean is it required in order to output the correct result, the answer is no. If you mean is it required in order for the code to be well written, then the answer is yes. Well written code is code that is unambiguous to the reader -- if I read your code and see you ignore a return value, I have to break out my ...
Top 50 recent answers are included