Qt/C++ Error handling

后端 未结 5 1942
谎友^
谎友^ 2020-12-12 17:14

I\'ve been doing a lot of research about handling errors with Qt/C++ and I\'m still as lost as when I started. Maybe I\'m looking for an easy way out (like other languages p

5条回答
  •  臣服心动
    2020-12-12 17:33

    You can put a catch (...) in or around main() Here's around:

    int main() try
    {
      ...
    }
    catch (std::exception & e)
    {
      // do something with what...
    }
    catch (...)
    {
      // someone threw something undecypherable
    }
    

提交回复
热议问题