On Sat, May 03, 2014 at 12:36:49AM +0100, Emil Velikov wrote:
> On 29/04/14 04:43, Chad Versace wrote:
> > The function creates and returns two objects: a context and a config.
> > The context is the function's return value, and the config is an out
> > parameter.
> > 
> > Functions with asymmetric returns, I find awkard. Fix the signature to
> > return both objects as out parameters.
> > 
> Hi Chad,
> 
> Rather silly question (as I'm getting through the codebase).
> 
> Wouldn't it be better if use return int over bool ? The function name does not
> imply that a bool is returned, plus it gives us the flexibility of returning
> appropriate (currently unneeded) errno.

In designing the Waffle's public API, I tried to follow the example of
EGL, which returns either NULL or false on failure. This design then
affected Waffle's internal APIs too.

In retrospect, I think choosing to model Waffle's error reporting on
EGL's model may have been a clumsy choice. If Waffle 2.0 ever happens,
then that would be a good time to reconsider the approach.

In general, returning int rather than bool does provide more flexibility
for reporting status, but I chose to use bool in this patch to be
consistent with the rest of Waffle.

If waffle_try_create_context() returned an enum that indicated the cause
of failure, then we could possibly eliminate the exit_on_fail parameter.
I would welcome such a cleanup.

I wish the public API, though, to remain consistent in how it reports
error. Return NULL or false, then the user inspects the
waffle_error_info if he wants more information, similar to
eglGetError().
_______________________________________________
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle

Reply via email to