Re: [AD] 4.3 error handling redux

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


On Thursday 27 July 2006 01:34, Elias Pschernig wrote:
> AL_ERROR_ABORT is not needed I think. (Is there any place in 4.2 that
> would abort the program? Certainly the user should decided that.)

Which is why you don't have to set it if you don't want it (I'm more than 
willing to change the default). But similar to the try/catch-like method I 
was attempting before, it'd be nice if you didn't have to check each and 
every function for errors. It'd help newbies catch errors, and it'd help 
seasoned developers get a bare-bones project started without having to check 
functions right away (or if they have a critical section of code that 
*cannot* fail, force the program to abort if it would).

> al_error_set should probably accept printf style parameters, it will
> make it much easier to have meaningful error messages.

I tried storing the error message locally in the error handling code (which 
would be needed for this), but I ran into a problem. The idea was to clear 
errors when you check them, so getting the error code + string would set them 
locally to OK/NULL. However, if you return a local string and clear it, the 
user will always get an empty string. If you make a duplicate, then the user 
will be responsible for free'ing it, and I don't think that would be good 
behavior.




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