Exception handling

Allan Sandfeld Jensen kde at carewolf.com
Wed Jan 29 21:11:42 GMT 2014


On Wednesday 29 January 2014, Rodrigo wrote:
> Dear all, analysing the source code of konqueror, I could figure out that
> the exception handling constructs of c++ is not frequently used in the
> project. Is there any recommendation for not using try-catch statements
> for handling errors in the project?
> 
Don't use C++ exceptions if you can avoid it, and if you must use them, keep 
them tightly controlled in an isolated part of the application. If you use 
exceptions in one place the entire call stack needs to be exception safe and 
if you use eventloop and reentrancy than can mean the entire application and 
all of its libraries. Most C++ libraries and applications are not exception 
safe, and no C libraries are, and it is hard and error prone to try to make 
them exception safe. In theory both Qt and KDE libs should be exception safe, 
but I wouldn't trust exceptions further than I could throw them ;)

`Allan




More information about the kfm-devel mailing list