Re: [cairo] Re: cairo c++ bindings





Murray Cumming wrote:

An if(somebool) will not add a significatn amount of run-time overhead.
I'd be happy to add a Cairo::set_ignore_errors(bool) function.

Actually it will if the code is inlined, as it can add significant size to the code and thus make things not fit in caches. A quick test reveals that this triples the size of the inlined code (for a phony test with one argument passed to the other function).

A more serious problem is that inlinining a single function call is an obvious win in speed (no matter how tiny) and the same size in code. But a function that has an if and a call, it is impossible to be certain which is better. It would be preferrable that the C++ wrapper be unquestionable for the majority of Cairo calls.

My preference would be for the C++ wrapper to not test anything or throw any exceptions, and to just wrap the "test status" call like every other Cairo interface. Calling code can do "if (cairo_c->error()) throw exception;"

The ideas mentioned below for using templates to make a different class that does throw exceptions may be a good idea, though, as long as the header files are still readable.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]