Maks Pyatkovskiy wrote...
>I think it's better for all don't use C++ exceptions in large C++ apps
for Palm OS at all. The size of 1st code segment and the limit of data
segment (it can be overfull by exception info blocks) are quite serious
obstacles for C++ apps. You can avoid these problems if you'll not make
new obstacles for your own programs...
Interesting. Anyone else care to weigh in with an opinion?
I ran into the same problem with a large app that made extensive use
of try/catch. I pretty quickly hit a limit - I think it was actually
data relative to A5, not segment 1. The CodeWarrior exception support
(this is two years ago) did have very low run-time overhead, but
generated significant extra data.
So I wound up reverting back to ErrTry/ErrCatch, though I defined my
own macro, which allowed me to switch back and forth between the two
approaches.
I have a large application with "half-hearted" exception handling.
I have been toying for a long time with either making it robust with serious
exception handling (adding a lot more catches-throws, and Palm OS wrapper
functions that throw and such). Or else just removing all the exception
handling and doing it all c-style (return codes, bleh) because it's a pain
on the other launch codes,
I did do a hack to get the Metrowerks exception support to work
without using globals, but it was a pain.
At 12:01am -0800 03-02-08, Palm Developer Forum digest wrote:
There is an ErrTry, ErrThrow, and ErrCatch mechanism for Palm. See the Palm
OS API Reference manual for specifics. They work similarly to the C++
mechanism, but don't introduce the overhead.
As Ben noted, these don't automatically call the destructors for C++
objects that are losing scope. The other problem is that you have to
be careful about using any local variables in the catch clause - if
they're not marked as volatile, then you can wind up using a stale
copy.
The old HHSJ article that I wrote about Palm OS exception handling is
on the Palm KnowledgeBase, titled "Using the Palm OS� Error Manager".
-- Ken
--
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/