[cairo] return value of _cairo_composite_rectangles_intersect()

Uli Schlachter psychon at znc.in
Sat Dec 19 02:08:24 PST 2015


Am 18.12.2015 um 01:35 schrieb Enrico Weigelt, metux IT consult:
> I've just seen that _cairo_composite_rectangles_intersect()
> has only two possible return values, but is declared cairo_int_status_t.
> The callers usually check it for zero/non-ero.
> Wouldn't it be easier to let it return just cairo_bool_t ?

I think that the general convention is to return status codes everywhere.
Callers then just check for success and otherwise then return the status code to
their callers etc until the "top function" is hit and does something with this.

So yeah, I guess a bool would be easier, but a status code is more consistent
with other functions which can return status codes (plus this means that callers
don't have to "invent" a status code if some function fails).

However, this is all just a matter of taste and if some code has good reasons to
do something else, why not?

99 little bugs in the code
99 little bugs in the code
Take one down, patch it around
117 little bugs in the code
  -- @irqed

More information about the cairo mailing list