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. Why does QT use so few exceptions?
QtWS25 Last Chance

Why does QT use so few exceptions?

Scheduled Pinned Locked Moved General and Desktop
17 Posts 9 Posters 17.8k Views
  • 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.
  • D Offline
    D Offline
    DenisKormalev
    wrote on last edited by
    #3

    Tobias, does it mean that some day (version of Qt like 6.10) we will have exception-style error handling in Qt, not error()-methods?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #4

      Denis: For consistency we should not mix error handling styles in modules, so I can not see this happen without causing a mayor version number change (since the non-exception style would need to get removed which will break source compatibility).

      But this is just my opinion: I am not aware of any plans for Qt 5 or later.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        danilocesar
        wrote on last edited by
        #5

        [quote author="Tobias Hunger" date="1286374926"]
        But this is just my opinion: I am not aware of any plans for Qt 5 or later.[/quote]

        NOOOOOOO!!! =P

        <a href="http://www.danilocesar.com">Danilo Cesar Lemes de Paula</a>
        Software Engineer

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #6

          danilocesar: What was that NOOOOO about?

          1 Reply Last reply
          0
          • D Offline
            D Offline
            danilocesar
            wrote on last edited by
            #7

            It's a good place to change major architecture decisions without harm current devs.
            From a simplistic point of view (without thinking about continuous improvement of current apps, kde, nokia, market, etc), who doesn't want Qt 5? :)

            <a href="http://www.danilocesar.com">Danilo Cesar Lemes de Paula</a>
            Software Engineer

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MTK358
              wrote on last edited by
              #8

              [quote author="Tobias Hunger" date="1286394948"]danilocesar: What was that NOOOOO about?[/quote]

              Just read this sentence and forget about the context of this thread:

              "I am not aware of any plans for Qt 5 or later."

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tobias.hunger
                wrote on last edited by
                #9

                MTK358: I do not know of any plans, that does not mean that nobody else is doing planning;-)

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  s.frings
                  wrote on last edited by
                  #10

                  To come back to the original question: Is there a technical reason, not to use exception to handle errors? I understood, that the reason was historically, so it's basically a good idea to use exceptions in my own programs.

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    Franzk
                    wrote on last edited by
                    #11

                    I don't think there would be a lot of places where Qt would really benefit from exceptions, but hey, I might be missing something :).

                    "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tobias.hunger
                      wrote on last edited by
                      #12

                      s.frings: Yes, there is no reason not to use exceptions in your own programs. I do not know whether it is a good idea for consistency reasons: I prefer not having to switch between exception/non-exception code, but that is just a matter of taste.

                      1 Reply Last reply
                      0
                      • I Offline
                        I Offline
                        ivan.todorovich
                        wrote on last edited by
                        #13

                        What about QSqlError ?
                        I find it annoying calling lastError() every time I execute a SQL query. I can't think of a better place to use exceptions instead of error codes. Not to mention that exceptions are thread-safe.

                        o_o Sorry for my rusted english.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          szh1
                          wrote on last edited by
                          #14

                          What are the advantages of Exceptions?

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            goetz
                            wrote on last edited by
                            #15

                            Some of them are explained "here":http://www.parashift.com/c++-faq-lite/exceptions.html

                            And keep in mind:
                            there is NO one size fits all! Exceptions might work wel for one case, but not for the other.

                            http://www.catb.org/~esr/faqs/smart-questions.html

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              szh1
                              wrote on last edited by
                              #16

                              I hope Qt starts to use exceptions soon!

                              1 Reply Last reply
                              0
                              • G Offline
                                G Offline
                                goetz
                                wrote on last edited by
                                #17

                                You'll have to wait at least until Qt 5 comes around.

                                All releases of the Qt 4 series will stay source and binary compatible. Switching to using exceptions is a far too big change. Maybe it will come sometimes, but don't expect anything. There aren't even rumors about a timeline of Qt 5, even less abut exceptions...

                                http://www.catb.org/~esr/faqs/smart-questions.html

                                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