I have been programming in C ++ for 5 years, why have I never seen the exceptions used instead of examples for examples?
I'm very curious. I am very curious about this since 1996. I used to think that in 1996, C ++ Exception Handling revolutionized the way I write software. I remember that I read about handling C ++ Exception, and I immediately understood the consequences. After a few minutes, I tested what happens if an exception is thrown from the constructor. Compilers for UNIX were not ready for C ++ Exception Handling before g ++ 3.0, I think (was that?). Destructors were called for undesigned memory locations (on the stack) (in the event of an exception being thrown). Destructors were not called for successfully constructed objects (on the stack) (in case of any exception). delete was not called if the object created with new threw an exception from the constructor. Compilers for Windows and OS / 2 were ready in 1996/1997. They worked. I remember Borland C ++ for OS / 2 and IBM CSet2 and Windows Visual C ++.
Finally, there was a method of interrupting the construction of an object. Finally, one could select an object inside the constructor AND rely on the successful construction of this object in some other constructor. Somehow I found out about all the rules. Not from books! Years later, books appeared claiming that C ++ Exception Handling is a good way to catch the "out-of-bounds" error or other problems for which I never stopped using assert. Finally, there was an easy way to provide the caller with complex information about some error without relying on stderr. Finally, there was no need to debug some complex software tools to find out what didn't work out.
I can't take seriously people who don't use C ++ Exception Handling. Unable to check every erroneous call. It is not possible to achieve the same level of software quality without using C ++ Exception Handling. Why are such people still hired? Why there are still platforms that do not provide C ++ Exception Handling. I would never have thought of writing software for such a platform, in the same way I would have refused to write a complex application in assembly code.
user678269
source share