[HarfBuzz] [PATCH] Implement threading primitives on Windows; fix compile error and leak

Ed ed.trager at gmail.com
Thu May 5 11:29:45 PDT 2011


Thanks for the clarifications, Behdad!  - Ed

On Thu, May 5, 2011 at 2:02 PM, Behdad Esfahbod <behdad at behdad.org> wrote:
> On 05/05/11 13:54, Ed wrote:
>> Hi, Behdad,
>
> Hi Ed,
>
>
>> As far as I am aware --please correct me if I am wrong-- the current
>> HarfBuzz NG code relies entirely on C-style "structs" and seems to
>> eschew implementing "true" C++ classes (i.e., those with
>> compiler-enforced private members, explicit user-defined constructors
>> and destructors, etc., (as opposed to "structs" which can be defined
>> as a more limited subset of "classes" where all members are public)).
>
> That's not entirety true.  We use as much as C++ as we can afford.
>
> For now, the rule is: no linking to libstdc++.  And I'm religious about that
> one.  Other than that, I've been freely using private, protected, templates,
> etc.  Still avoiding virtual, constructors and destructors where they make
> memory management harder.  But where they ease it, by all means, I'm already
> using them.
>
>
>> So I assumed that HarfBuzz NG was not actually using C++ at all --and
>> that perhaps the reason was to insure the possibility of compilation
>> in some sort of embedded device environments where C++ compilers are
>> not used ... or something like that.
>
> As I said, the rule's simple: no libstdc++ linkage.  Other than that, if it
> compiles with g++, and compiles with MSVC, it's good enough.
>
>
>> But now you are saying that HarfBuzz is using C++.  So, if that is the
>> case, then why are you not using a code development model that takes
>> full advantage of C++ and do precisely things like "use constructors
>> to initialize static mutexes automatically", inter alia ?  And why not
>> take advantage of other aspects that C++ provides, like true private
>> and protected members?
>
> I already do, in a lot of the code if you take a look.  For some structs I
> don't mark private members because we have static instances of those, and you
> can't have a static initializer for a class with private/protected members.
>
>
>> That's one question.
>>
>> But a related valid question is: would you accept contributions to the
>> code base that do utilize true C++ classes featuring things like
>> constructors, destructors, protected and private members, despite the
>> fact that such contributions would differ in coding style from what
>> you are currently creating?
>
> You're right that my coding style in HarfBuzz is indeed that of a C
> programmer, freely using C++ features when more convenient.  I don't
> categorically reject other code styles, though I really like tight code, and
> will say so if I see otherwise.
>
> Cheers,
> behdad
>
>> Best - Ed
>



More information about the HarfBuzz mailing list