Re: [AD] 4.3 error handling redux

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


On Friday 28 July 2006 18:45, Peter Wang wrote:
> > What would you call the other function? Somehow I don't think
> > al_get_error_ext would fly very well after 4.2's *_ex function flood, and
> > al_get_error_str sounds a bit ambiguous since it'll return the error code
> > too.
>
> I don't think that's too bad.  al_get_error_message() ?

What I was thinking was that you'd have

AL_ERROR_ENUM al_get_error(void);
and
al_get_error_something(AL_ERROR_ENUM *code, const char **str);
(or AL_ERROR_ENUM al_get_error_something(const char **str); )

the idea being, that getting the error code clears it, so the string would 
need to be cleared at the same time (and needing to call two functions to 
fully clear the error would be wasteful).

The current way, what I currently prefer, would be that you have one function, 
which returns the error code, and you could pass NULL as the parameter if you 
didn't want the string description (or you could pass a pointer to a char 
pointer and get the string).. either way, both would be cleared at the same 
time, and you didn't have to worry about multiple methods and ambiguous 
names.




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