Re: Pango Performance (was: Re: --gtk-unbuffered)



egger suse de writes:

> On  1 Mar, Tor Lillqvist wrote:
> 
> >  > +  return (1 == has_glyph);
[ ... ]
> 
>  Just curious: Whats the rationale for this "strange way to code"?

It makes the frequent mistake of typing "=" where you meant "=="
produce a compiler warning, instead of misbehaving in confusing ways.

For example:

    if (a=1) {
      printf("A is one");
    }

will assign the value of 1 to a, then see if a is nonzero (which it
always will be, since we just assigned it a value of 1), and if it is
print "A is one".  Probably what was really meant is:

    if (a==1) {
      printf("A is one");
    }

If you get in the habit of typing the constant part before the
variable, you get an equivalent statement if you type it correctly:

    if (1==a) {
      printf("A is one");
    }

but a compiler error if you make the common typo:

    if (1=a) {
      printf("A is one");
    }


------ScottG.




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