freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] meddlesome compiler warns against "for( ...; ...; ...) ;


From: David Turner
Subject: Re: [ft-devel] meddlesome compiler warns against "for( ...; ...; ...) ; "
Date: Sun, 12 Oct 2008 11:01:30 +0200

Hello mpsuzuki,

since the original code sets manageCvt to mcvt_retain unless there is a difference
between the blend->normalizedcoodrs and coords array, please replace with something like:

manageCvt = mcvt_retain;
for ( i = 0 ; i < num_coords; i++)
{
    if ( blend->normalizedcoords[i] != coords[i] )
    {
      manageCvt = mcvt_load;
      break;
    }
}

which does the same thing in less ambiguous ways.

thanks in advance

2008/10/9 <address@hidden>
Hi all,

During the play with legacy CodeWarrior and MPW, I found
these legacy C compilers warn the coding style like

       for ( i = 0 ; i < N ; i++ ) ;
         ...

They guess ";" is a mistake (by the author) and
the procedure ... is expected (by the author) to be looped.

In FreeType2, src/truetype/ttgxvar.c includes such coding

  908        for ( i = 0;
  909              i < num_coords && blend->normalizedcoords[i] == coords[i];
  910              ++i );
  911          if ( i == num_coords )
  912            manageCvt = mcvt_retain;
  913          else
  914            manageCvt = mcvt_load;
  915

The compilers warn against ";" on line 910. At present,
no compilers are aborted by such coding (in fact, K&R
text includes such example), but they warn.
To suppress the warning, I want to change the code
aslike

  908        for ( i = 0; i < num_coords; ++i )
  909          if ( blend->normalizedcoords[i] == coords[i] )
  910             break;
  911        if ( i == num_coords )
  912          manageCvt = mcvt_retain;
  913        else
  914          manageCvt = mcvt_load;

Please comment which is easier, and is it worthful to
suppress such warning.

# if FreeType2 includes such codings in many places, I won't
# fix all of them. But it's only once, at present.

Regards,
mpsuzuki


_______________________________________________
Freetype-devel mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freetype-devel


reply via email to

[Prev in Thread] Current Thread [Next in Thread]