Re: [AD] 4.3 error handling

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wednesday 07 June 2006 15:04, David Schwingenschlögl wrote:
> As neat as the whole idea sounds, here's one thing that keeps bothering
> me: How does stack unwinding work in the face of al_error_try and
> al_error_catch? (Oh, and by the way, I'd rather prefer al_try and
> al_catch, as that "error" part contains no information for me whatsoever
> ;).

Function names are fully up for changing. :) I just threw it all together 
(heck, some even start with al_error_*  and others use al_*_error). As for 
unwinding, each al_try just sets a setjmp point. When you throw, it'll jump 
back to the last set point and make the previous one current (first-in, 
last-out), and if you reach al_catch without error it'll just clear the last 
set jump point (there can be up to 16 jump points in this code, though it can 
easilly be changed to be dynamicly allocated). If you try to throw without a 
jump point being set, it'll call the unhandled_error function, which would 
cause Allegro to abort as cleanly as possible and display an error message.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/