Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exception Handling
Forum Updated to NodeBB v4.3 + New Features

Exception Handling

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rbonifacio
    wrote on last edited by
    #1

    Dear all,

    Analysing the source code of qt-x11-opensource, I could figure out that the exception handling constructs of c++ are not frequently used in the project. Is there any recommendation for not using try-catch statements for handling errors in the project?

    All the best,

    Rodrigo.

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi, welcome to devnet.

      Qt doesn't use exceptions mostly for historical reasons. At the dawn of times, when Qt was born not all target compilers supported them correctly. Now of course things changed but there's always a question of consistency and backward compatibility. Why rewrite something that works and break a lot of software out there while doing it?

      So there's no reason to use or not use exceptions in your own programs that use Qt. Qt itself will not throw exceptions (mostly) but is not entirely exception safe. Some more info "here":http://qt-project.org/doc/qt-5/exceptionsafety.html
      As a rule of thumb if you decide to use exceptions try to keep their scope tight and don't throw across boundaries (outside slots, threads etc.).

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rbonifacio
        wrote on last edited by
        #3

        Dear all, I am conducting a survey about the use of exception handling constructs in C++. I would really appreciate if you could contribute to this research by answering a few questions on the subject.

        The survey is available on-line:

        https://pt.surveymonkey.com/s/exceptionHandling

        All the best,

        Rodrigo.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved