freetype-devel
[Top][All Lists]
Advanced

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

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


From: mpsuzuki
Subject: [ft-devel] meddlesome compiler warns against "for( ...; ...; ...) ; "
Date: Thu, 9 Oct 2008 18:20:38 +0900

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




reply via email to

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