Java has a compiler that checks for exceptions . When I switched to C ++, I found out that it does not contain checked exceptions. At first, I continued to use exception handling because it is a great feature. However, after some time I refused it, because I got into the situation, every function could throw an exception. Since only a small percentage of the functions I write can throw exceptions (say no more than 25%), I found the overhead of handling exceptions for functions that cannot throw anything unacceptable.
Because of this, I am really surprised that there are many developers who prefer excluded exceptions. So I'm curious to know how they deal with this problem. How to avoid the overhead of doing unnecessary exception handling if the language does not support checked exceptions?
Note: My question applies equally to C ++ and C #, and possibly to all other languages that do not implement exception handling using the compiler.
source
share