OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

> C++ Exception Handling, does it work with arm-linux-g++?
rafm
post Nov 20 2005, 05:16 AM
Post #1





Group: Members
Posts: 145
Joined: 13-November 04
Member No.: 5,449



Is it possible to handle C++ exception in Qtopia applications?

I compile my application without the "-fno-exceptions" flag, but nevertheless the execeptions do not seem to work. The application aborts instead of catching the exception.
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 7)
lpotter
post Nov 20 2005, 09:42 AM
Post #2





Group: Members
Posts: 451
Joined: 27-November 03
From: Brisbane, Australia
Member No.: 1,001



Qt/E for Qtopia is compiled without exceptions.
Go to the top of the page
 
+Quote Post
rafm
post Nov 20 2005, 10:52 AM
Post #3





Group: Members
Posts: 145
Joined: 13-November 04
Member No.: 5,449



QUOTE(lpotter @ Nov 20 2005, 06:42 PM)
Qt/E for Qtopia is compiled without exceptions.
*


Does it mean that I cannot use exceptions at all, or I must catch exception before the QT event handler?

I am working on a GUI application that should handle exceptions within a single method before the control is returned to the QT event handler. I would expect that, if everything is compiled correctly, exceptions should be handled within my methods.
Go to the top of the page
 
+Quote Post
rafm
post Nov 21 2005, 11:32 AM
Post #4





Group: Members
Posts: 145
Joined: 13-November 04
Member No.: 5,449



QUOTE(rafm @ Nov 20 2005, 07:52 PM)
Does it mean that I cannot use exceptions at all, or I must catch exception before the QT event handler?
*


I did some research and I can answer this question myself. Exceptions work as long as neither -fno-exceptions nor -fno-rtti are specified (exception handling uses rtti internally). However if -fno-rtti is missing, compilation fails when linking with the QT. So it seems that GUI applications can not use exceptions. That's a pitty, since error handling without exceptions needs quite a lot of work and results in not so clean code.

Is there any way around to use both exceptions and the QT? I am curious what was the motivation to disable exceptions in the Qt/E.
Go to the top of the page
 
+Quote Post
lpotter
post Nov 22 2005, 10:29 AM
Post #5





Group: Members
Posts: 451
Joined: 27-November 03
From: Brisbane, Australia
Member No.: 1,001



Exceptions have a large overhead, and create larger binary and memory requirements.

I find it is actually easier to deal with errors without exceptions, and it takes more work and lines of code try catch statements then simply checking for error codes and such.

Remember, Qtopia and Qt/E are run in limited memory spaces.

From http://www.pnp-software.com/ObsFramework/d...tionIssues.html

QUOTE
As expected, the most important gain arises from the use of the -fno-rtti and -fno-exceptions  options. The -fno-rtti option removes all code and data related to the use of the C++ run-time type information mechanism. The -fno-exceptions removes all code and data related to the use of the C++ exception mechanism (recall that the framework classes use a very restricted subset of the C++ language that does not use either the RTTI or the exception mechanisms). Taken together, these two options basically eliminate the overhead associated to the use of the C++ language.
Go to the top of the page
 
+Quote Post
Mickeyl
post Nov 23 2005, 05:43 AM
Post #6





Group: Members
Posts: 1,497
Joined: 12-November 03
From: Germany
Member No.: 907



For the records... a lot of computer scientists agree that structured exception handling is to be preferred over checking return codes or global variables. See also http://www.nedbatchelder.com/text/exceptions-vs-status.html for some more background on that matter.

I agree that the particular C++ exception handling implementation may be too bloated for the usage in resource constraint environments but please don't make that conclusion for structured error handling in general. I've read papers that prove that well written structured exception handling code can lead to even smaller code than the classic return code / global value style.
Go to the top of the page
 
+Quote Post
lpotter
post Dec 1 2005, 11:36 AM
Post #7





Group: Members
Posts: 451
Joined: 27-November 03
From: Brisbane, Australia
Member No.: 1,001



QUOTE(Mickeyl @ Nov 23 2005, 11:43 PM)
I've read papers that prove that well written structured exception handling code can lead to even smaller code than the classic return code / global value style.
*


I would like to see proof... smile.gif
Go to the top of the page
 
+Quote Post
Dobby
post Aug 19 2006, 12:44 PM
Post #8





Group: Members
Posts: 84
Joined: 20-July 06
Member No.: 10,467



Probably digging up this topic a bit as it hasn't seen activity since the end of last year but I'd like to say that while it may add some overhead in terms of memory exceptions only slow performance when invoked. In other words when an exception is actually thrown.

And yes it is considered better design to use exceptions. Countless times I've seen code greatly simplified by the use of them. Whether this out weighs the overhead I can't vouch for the Zaurus but I've been using exceptions for the last ten years and as this was around the time of the 486 I don't think it's really that big a problem for the xscale.

So now I've got that off my chest has anyone managed to get exceptions working? smile.gif Not that I've tried yet I'm just researching at the moment.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 26th December 2014 - 12:01 PM