On Wed, 03 Aug 2016 13:41:51 -0700, Thiago Macieira wrote:

> It's still a source of errors because the nesting counter can be
> incremented in different ways, depending on what triggered the event. So
> the recommendation remains: avoid nesting like the plague.

void doIt()
{
    ...

    int option = askForOption();

    ...

    if ( doYouReallyWantTo( option ) )
    {
        ...
    }
}

Having to write this code without nested loops ( f.e. QDialog::exec() ) 
leads to 3 method ...

- before askForOption
- between askForOption and doYouReallyWantTo
- after doYouReallyWantTo

... where you always have the problem to transfer the variables from the 
stack ( here option ).

Once your code ends up in sequences of between-GUI-interactions methods 
you will have way more problems, than what nested event loops might be.

So yes nested loops might be a problem, but not using them is IMHO the 
wrong consequence.

Uwe


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to