[pulseaudio-discuss] [PATCH] add section about error handling to doxygen documentation

Peter Meerwald pmeerw at pmeerw.net
Mon Dec 12 07:48:51 PST 2011


Hello Tanu,

> > I fully agree, this sounds sensible
> > I don't see a reason to have error codes as int and not enums -- but I 
> > guess that would be a too bit change at the moment

> A couple of reasons come to mind (I don't know the original reasoning):
>  * In cases where a function can return either a negative or positive
> number, using pa_error_code_t would not be the correct type for the
> positive value (ie. not error). And actually, since pa_error_code_t
> values are non-negative, it would be an incorrect type also for
> functions that return the errors as negative numbers.

well, there is return code and there is error code

one way to clean up and make explicit what kind of values are allowed 
would be to change

int foo(int *error); 
to
int foo(pa_error_code_t *error);

return code stays the same, error code changes from int to pa_error_code_t

obviously, functions such as pa_context_errno() would need to change...

I am not pushing this change for the moment

regards, p.

-- 

Peter Meerwald
+43-664-2444418 (mobile)


More information about the pulseaudio-discuss mailing list