[HarfBuzz] harfbuzz-ng: Branch 'master' - 2 commits

Behdad Esfahbod behdad at behdad.org
Fri Nov 20 16:22:22 PST 2009


On 11/20/2009 06:58 PM, Neil Mayhew wrote:
> A couple of comments:
>
> On 09-11-20 1:35 PM Behdad Esfahbod wrote:
>> (Error: A union member cannot have a user-defined assignment operator)
> None of the changes here directly affect any unions, only structs, so
> maybe the assignment operator could have been kept? If a struct contains
> a union, then you can't use the compiler-generated assignment operator,
> but you can still define your own and use something other than = to copy
> the union variable from the other object to this.

The problem occurs in cases like:

   union {
   USHORT                format;         /* Format identifier */
   CoverageFormat1       format1[VAR];
   CoverageFormat2       format2[VAR];
   } u;

where previously USHORT had an overloaded assignment operator.  I could "fix" 
this by wrapping USHORT into a separate Format struct.  One way or the other.


> However, maybe SANITIZE_OBJ needs to work across a range of types that
> includes unions, and so you need to add a method everywhere to allow
> uniform treatment. Even so, I didn't see any set methods being added to
> unions in this commit.

The only place in the SANITIZE code that we actually assign anything is in 
NEUTER().  And we only neuter offsets, which are int types and inherit that 
set() method.

>> So we use a set() method instead of the assignment operator.
> FYI, the naming convention adopted in the C++ standard library is
> "assign", eg in std::string, so it might be a good idea to follow that.

Our C++ usage is so limited and different from most "standards" that I don't 
see much point really :).

Cheers,
behdad


> --Neil



More information about the HarfBuzz mailing list