[Pixman] [PATCH/RFC 0/4] New option to build pixman as C++ code (--enable-enforced-cplusplus)

Behdad Esfahbod behdad at behdad.org
Mon Dec 17 10:10:38 PST 2012


On 12-12-16 06:06 PM, Siarhei Siamashka wrote:
> On Sun, 16 Dec 2012 15:34:57 -0500
> Behdad Esfahbod <behdad at behdad.org> wrote:
> 
>> On 12-12-16 12:13 AM, Siarhei Siamashka wrote:
>>> Any comments or ideas? Hopefully not a C vs. C++ flamewar :)
>>
>> I would go as far as suggesting that C++ becomes a requirement.  I did that in
>> HarfBuzz and never looked back.  It's possible to use many useful features of
>> the language (templates, etc) without linking to libstdc++, so from the user's
>> point of view there's absolutely no difference between that kind of a library
>> and a C library.
> 
> One problem with these useful C++ features is that making use of them,
> we are wilfully becoming the hostages of a compiler. But the real
> existing compilers are struggling even to handle inline functions
> without bugs and performance regressions:
>     http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54965
> 
> So I'm leaning to remain conservative and initially use C++ features
> only as a debugging aid. Just like OpenMP, gcc vector extensions,
> 128-bit float types and the other fancy compiler features are only
> used (or proposed to be used) in the test suite.

You definitely have a point.  However, this exact example is why I always
thought Pixman in particular can make good use of templates.  Because
essentially that's what Pixman is: operation templates instantiated with lots
of different options.  Currently we just use always_inline and hope that the
compiler does the right thing.  With C++ those become template instantiations
that have much more chance to be inlined and optimized.  Incidentally, I think
that's the approach Skia took.

Anyway, just dropping ideas on the table.

-- 
behdad
http://behdad.org/


More information about the Pixman mailing list