> > 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.
>
> Oh, *those*.  I didn't realise anybody actually used them :-).

Despite of all the problems it raises (variables mysteriously changing if
you forget the 'volatile' keyword, important overhead...), it is the only
way to have exception-like mechanism in C. Unless I missed something...

> You're absolutely right:  they're supplied by the operating system, so
> if you think Palm OS is one cohesive whole [...]

I've never thought such a thing ! :-)

> Okay, so you really do want to abort the sort immediately.  Fair enough,
> but it's not something that's supported by SysQSort(), which isn't
> ErrException-safe.  You do have the option of writing your own sort
> routine, at which point you have the opportunity to abort via any
> mechanism you like -- and you're sure to find a more efficient one than
> ErrorMgr exceptions.

Yes, I do want to abort the sort. As you suggested, some fatal error
condition can occurs in the comparison function. I think I'll write my own
SysQSort, it's simple, but it wastes space and time...

> Int16 cmp (void *a, void *b, Int32 other) {
>   if (indicates_weve_already_failed (other))
>     return (char *)b - (char *)a;
>   else
>     return do_the_real_lookup_and_cmp (a, b, other);
>   }

I'm not sure, but I expect this won't work. I think the quicksort algorithm
behaves badly if you change the sorting order while processing, because it
may not be able to find a pivot point in the current partition. This will
probably make a pointer to read/write out of the bounds of the array, or
other bad thing.

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