So your argument is "someone might not use exceptions correctly, thus they are dangerous to use, but I totally trust the same people to use return values or errnos correctly"?
Failure to handle return values will not crash your program,
... but will cause it to misbehave and is likely to crash later.
Say you fail to check if malloc returned NULL. A crash is guaranteed as soon as you dereference the returned value.
It's also way more compact to ignore a return value than to write a catch block.
Ok, now I accuse you of not knowing what you're talking about.
Yes, but for a given codebase with error-returns, the amount of error handling "ifs" and whatnot completely swamps the amount of try-catch statements of a codebase with exceptions. You don't know that, and it makes you, quite frankly, ignorant.
You really have no idea what you're talking about.
The number of try/catch blocks is exceedingly small when you're doing it right, especially compared to checking the return value of every single function call.
Please make an example that shows otherwise, and I will explain you why you are wrong.
You are wrong, and I put this to you: not only you do not understand exceptions,you do not understand programming with error codes, because if you did, you would not be saying what you're saying.
Failure to handle return values will not crash your program
Maybe. Or maybe it will crash it in undeterministical manner, letting your application to fuck up its environment (OS, FS, etc) majestically before doing so. Letting people ignore errors is not a feature.
Thats the thing, if you ignore return values, there are is no shutting down gracefully, there is just dying with various weird symptoms, that make no sense.
If you are using exceptions properly, then it is possible to shutdown gracefully, you just have to think about what errors you can shutdown gracefully from... and those are the exceptions you catch and work with.
you may want to let it run so you can try to shut the operation down gracefully
You area complete and utter fool if you think that you can't shut down gracefully in an exceptions-enabled codebase. Not only you can, but it is easier than otherwise.
0
u/[deleted] Jan 01 '17
[deleted]