Not too long ago I asked this question on Stackoverflow,
How do you implement the factorial function in C++? And by this I mean properly implement it using whatever argument checking and error handling logic is appropriate for a general purpose math library in C++.
Of the five answers I got only four actually showed any code. Of those not a single one was production quality, they all all just cute ways to answer homework problems. In fact someone tagged my question as “homework” and others closed it as a duplicate. Not a single one correctly handled n=-1, nor did any of the examples in the questions they linked to.
Seeing that the moron squad didn’t even bother reading the question and only glanced at the headline I asked again. This time making sure to include “with proper error handling” in the title. I got two more answers, this time with no code what so ever and again no discussion on proper error handling in C++.
Why are applications and operating systems still so unreliable after all these years? Possibly because the C++ community that they are based still thinks “undefined behavior” is the correct response whenever someone passes in invalid arguments.