[Qt5-feedback] Qt5 and C++ exception
André Pönitz
andre.poenitz at nokia.com
Mon Jun 27 10:47:04 CEST 2011
On Monday 27 June 2011 10:11:21 ext Дмитрий Б. wrote:
> I very much respect your opinion, but there is a part of community
> who believe that exceptions is very important.
>
> In addition it is one of the standard of the C++ which Qt does not
> support on the API level
> and it is a standard for any object-oriented library at all.
You mistake "Not using" for "Not supporting".
The fact that Qt does not use the expression "45+57" anywhere in its code
does _not_ mean it does it does not "support it". It only means there have
been no good reasons to use it. You can use it anywhere in your own code,
Qt does not prevent you from doing that.
That's pretty much the same situation with exception: You are free to use
exceptions in your own code, also when using Qt. It's your decision.
There are few very good reason for not using exceptions in the interface of
C++ libraries. One is that exception specifications are _not_ sufficient do
specify all possible exceptions if you don't control all potentially throwing
third party components. And even if you do you cannot guarantee it won't
change in the future. It's also unreasonable to assume that Qt can update
it's own interface just because some underlying "helper" library adds an
exception to its own interface. Other items to consider include size of
generated code, source code bloat on the user side due to try ... catch
blocks etc.
Andre'
More information about the Qt5-feedback
mailing list