[Qt-interest] Qt and C++ exceptions
Piotr Dobrogost
pd at 2009.gmane.dobrogost.pl
Sat May 23 14:48:59 CEST 2009
Paul Floyd wrote:
> Maxim Egorov wrote:
>> Why qt does not use exceptions? This is a very powerful mechanism which allows to significantly simplify the processing of errors and create more reliable software. I have read http://qt.gitorious.org/qt/pages/CodingConventions and was amazed. I think this is a very strange decision. It seems to me that so hard to find C + + compiler does not support exceptions. So I think it would be wise to consider support for exceptions to be one of the most important tasks.
>
> Two things
> a) When Qt was originally developed, not all compilers supported
> exceptions, so the core components were written using relatively
> unsophisticated C++ (no exceptions, no fancy templates). Other than
> easing portability, in my experience exceptions and fancy templates
> usually mean poor performance and code bloat (and long compile times).
Poor performance due to exceptions?
Good implementations have zero overhead if exceptions are not thrown.
Code bloat?
Templates are the best way to generate as little code as it's possible
given a spectrum of used types. Try to write it better by hand...
Long compile times?
How long? 20s instead of 10s? Does it make it up for loosing power of
generic containers for example?
> b) Exceptions are difficult (read Herb Sutter for gory details). I'm not
They are because they are part of programming :)
Thousands of manual checks trying to cover tens of thousands of code
paths are even more difficult...
> sure that I'd want to use a library that forced me to try to write
> exception safe code.
That's not a library that should force you but drive to create robust
software.
--
Piotr Dobrogost
*** curlpp.org - c++ wrapper for libcurl ***
More information about the Qt-interest-old
mailing list