[cairo] API Shakeup: Consistent error handling for all objects

DANIELLLANO DANIELLLANO at terra.es
Thu Feb 24 11:38:56 PST 2005


Carl Worth wrote:
> I propose making all objects in cairo use an error handling scheme
> similar to cairo_t. That is, rather than each function returning
> cairo_status_t, most functions are void and error state is stored in
> the object itself, (and can be queried). An object in an error state
> is inert, and functions can be safely called on it with no side
> effects.

Seems like using exceptions but in the same object not in another
exception object.
Do you know of any C software already doing your proposal or you feel
like doing some live research with cairo?

> Additionally, I propose to extend the current scheme so that all create
> functions are also guaranteed to "work". That is, in the case of
> out-of-memory, the functions will return a pointer to a static
> in-error object.

Other option I like is to wait for memory to be available but it can
deadlock the system if many programs wait for memory.

> I haven't implemented all of this, so I'm not sure it won't fall apart
> at some point, but I am optimistic it will work quite well.





More information about the cairo mailing list