[Development] Disabling exception support in QtCore?
Olivier Goffart
olivier at woboq.com
Thu Oct 10 18:02:38 CEST 2013
On Thursday 10 October 2013 08:22:44 BRM wrote:
> I have personnally maintained a 400k+ SLOC codebase based on QT.
> It made extensive use of Signals/Slots between objects. Even though I was
> pretty much the only developer working on it, I still had to quite often
> track through signals/slots to make sure I understood things. Not because
> the codebase was unclear, but because it was quite non-trivial. It would
> have been an extensive PITA to try to know which ones I could or could not
> use exceptions with.
>
> I'm no compiler expert - but without help from the compiler to make sure
> that kind of things doesn't happen - e.g. marking signals/slots as
> Q_EXCEPTION_THROW and Q_EXCEPTION_SAFE and having some part of the compiler
> chain detect and at minimal warn of issues - it will not be feasible.
Programming is not easy.
Now, our goal is to make programming with Qt as easy as possible.
Tell me what makes programming easier:
1) We forbid any use of exception in any slot connected to any signal.
- Programmers that don't use exceptions don't care because it does not
impact them.
- Programmers that uses exception in their application to forward errors
cannot use signals and slots to propagate exceptions from one object of their
application to another anymore.
2) We allow slots to forward the exception to the signal.
- Programmers that don't use exceptions still don't care because it does
not impact them.
- Programmers that use exceptions can hapilly let exceptions go from the
slot to where the signal is emitted.
If you are not using exception now as I understand from your text above, then
nothing changes for you.
However, someone who is using currently exceptions, they will have to change
their code for more complicated code because we decided to forbid it ("for
their own good")
May I recall that exceptions through signals and slots always worked, and was
used. And now you need to give a good reason to forbid it.
Reducing the size of QtCore might be a good reason, but just saying "it's for
your own good" is not.
--
Olivier
Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
More information about the Development
mailing list