[Development] Disabling exception support in QtCore?

Olivier Goffart olivier at woboq.com
Thu Oct 10 15:25:42 CEST 2013


On Thursday 10 October 2013 15:14:02 André Somers wrote:
> Op 10-10-2013 14:53, Olivier Goffart schreef:
> > On Thursday 03 October 2013 10:38:59 Thiago Macieira wrote:
> >> On quinta-feira, 3 de outubro de 2013 10:36:44, Olivier Goffart wrote:
> >>>> I dislike allowing this via the signal-slot mechanism because I see
> >>>> throwing from a slot as incompatible with the connection semantics.
> >>>> 
> >>>> That would mean any signal could throw ANY exception. It would also
> >>>> preempt
> >>>> the execution of further slots, which might be important.
> >>>> 
> >>>> Usually the person who connects a signal to a slot is a completely
> >>>> different developer than who wrote the signal or the slot.
> >>> 
> >>> I think your assumptions are false.
> >>> When using signals and slot in an application one write both the signal
> >>> and
> >>> the slot at the same time, to wire two part of that same appliation.
> >> 
> >> That's not at all true. If it were, we wouldn't have signals or slots in
> >> our public API. If people were supposed to write the signals and the
> >> slots they connect, all our signals and slots would be private.
> > 
> > I did not said that the signal and the slot were always written by the
> > same
> > person.  And I explicitly said for an application, and you are talking
> > about libraries.
> 
> Even for applications this statement is nonsense. For all but trivial
> applications that during their lifetime only get worked on by a single
> developer, the likelyhood of the same person always writing the slots
> for every signal goes to 0 rapidly with the age and number of developers
> on a project.

That's not what I said.
And regardless, I don't think it has any relevance for the problem in 
question.

Within a code base that uses exception, developers should know which part of 
the code is exception safe and which part of the code can throw exception.  
And they know they should not call a function that can throw an exception from 
code that is not exception safe. (Hence they don't connect a signal from code 
that is not exception safe to a slot that throw an exception)

-- 
Olivier

Woboq - Qt services and support - http://woboq.com - http://code.woboq.org





More information about the Development mailing list