[cairo] Re: cairo c++ bindings

Max Vasin max.vasin at gmail.com
Mon Nov 28 12:02:30 PST 2005

Mike Hearn wrote:
> On Mon, 28 Nov 2005 10:33:02 +0100, Murray Cumming wrote:
>>So, this remains a highly theoretical performance issue, but one that
>>could easily be tested.
> Right.
>>If it is a problem, then the proposed disabling of exceptions would
>>mostly eliminate it, by leaving us with just one extra
>>if(exceptions_enable) for each function call. I can't imagine what you'd
>>be drawing for which that would be a significant amount of work.
> Even better, make two classes (maybe using a template? I'm no C++ expert)
> which have identical code except with a different initialization value for
> the constant "exceptions_enable", that way the dead code elimination pass
> will delete the check entirely and you have optimal code. Then the
> programmer can just switch between them using "new CheckedCairo" or "new
> Cairo" for instance.

Even better: make a single class template with error handling policy as 
template parameter. No dead code at all. And programmer won't be limited 
to error handling policy used by wrapper.

WBR, Max Vasin.

More information about the cairo mailing list