> What's an exception?
>
> No, really :-) -- CodeWarrior and GCC both have their own ways of
> implementing C++ exceptions, and their implementations may even change
> in the future.  Because implementations of these things on m68k Palm OS
> vary, it's not practical to burn knowledge of them into the Palm OS ROM.
> That's why the current Palm OS API is a C API: it's (modulo bugs in the
> ABI, such as it is :-() the lowest common denominator across the tools
> used to build Palm OS applications.

I was talking of the ErrTry/ErrCatch/ErrEndCatch block, and the ErrThrow
function. It seems reasonable to think that this is the lowest common
denominator, since it is the mechanism provided by the OS.

> Throwing exceptions back through an OS function is not a very good idea
> and in fact is probably undefined (?).

On simple functions like SysQSort, this works perfectly, modulo the memory
leak. But you're probably right, this is not a good idea for most OS
functions.

> The way to handle this is not to
> allow an exception to escape from your comparison function, but to signal
> the failure back to the caller some other way, such as via SysQSort()'s
> _other_ parameter.  Such is life when you're calling a C function.

There is no way to stop the sorting process from within the callback
function. And exception entry code is slow. The callback beeing called about
n*log(n) times, I'd rather catch exceptions globally than locally.

> Thus you avoid this memory leak on existing ROMs now.  No "improvements"
> needed.

Yes, improvement is needed !

Pascal



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to