-

   rss_forum_sources_ru

 - e-mail

 

 -

 LiveInternet.ru:
: 29.07.2007
:
:
: 80

:


goto vs break & continue

, 14 2020 . 11:56 +
JoeUser:
Wound @
, .

. , , Qt. - :

    try {
    connect(thread, &MyThread::started, this, &Element::count); // count()
    }
    catch(const X& e) {}


, , :

    class BadCounter {
    Q_OBJECT
    public slots:
    void count() { throw std::runtime_error(", !"); }
    };
    class BadCounterAdaptor {
    Q_OBJECT
    BadCounter* counter;
    public:
    BadCounterAdaptor(BadCounter* iCounter):counter(iCounter) {}
    public slots:
    void count() {
    try {
    counter->count();
    } catch (const std::runtime_error& e) {
    std::cerr << e.what() << std::endl;
    } cstch (...) {
    std::cerr << " !" << std::endl;
    }
    }
    };
    int main() {
    BadCounter Counter;
    BadCounterAdaptor Adaptor(&Counter);
    QThread* Thread = new QThread();
    connect(Thread,&QThread::started,&Adaptor,&BadCounterAdaptor::count);
    Thread.start();
    ...
    delete Thread;
    }

- . - " , - , MFC !" :)


Wound @
- ,

! :'(

https://forum.sources.ru/index.php?showtopic=362619&view=findpost&p=3834229

:  

: [1] []
 

:
: 

: ( )

:

  URL