Re: [AD] 4.3 error handling redux

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


On Wednesday 26 July 2006 00:09, Peter Wang wrote:
> Does this mean that if I don't want to use any fancy callbacks, I call
> al_error_set_handler(AL_ERROR_IGNORE) at the start of the program and
> check every function call with al_error()?

Yup. Could even be made to be a flag in al_init if you wanted. Though if you 
wanted to check every function with al_error, you could first check the 
function's return value, and if that indicates failure, then use al_error 
(since the variables are TLS you may not want to go checking it all the time 
if you don't need to).

> Would the error code get 
> cleared if the function succeeds, or is it left untouched?

It's left untouched. AFAIK, with OpenGL and OpenAL error codes remain set 
until you check the GetError function, where it is cleared, and I was aiming 
to emulate that.

> I would have two versions of al_get_error(): one that returns a code
> only, and one that returns the string also.

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.

> AL_ERROR_OK (or AL_ERROR_NONE) should be defined in the documentation as
> zero so users can depend on it.

Sounds reasonable.




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