for loop fixes

Francois Gouget fgouget at free.fr
Sat Mar 3 21:17:41 CST 2001


On Sat, 3 Mar 2001, Andreas Mohr wrote:
[...]
> - changed all terminating ";" of isolated for loops to " ;" to indicate the
>   loop's isolation.

   IMHO, for such loops the following would be much clearer:

   <init_expression>;
   while (<test_condition>) {
     <update_expression>;
   }

  (ok, you can also put '{' on the next line)


> Please do the same for these for loops in the future.

   ???

> Somebody might want to write a Wine coding guidelines article...

$ wg . -E 'for *\(' | grep -E '\) *; *$'` | wc -l
     96

   (wg is my recursive source grep script)

   Maybe we should ask people to put the for and the instruction it
applies to on separate lines. Combined with the suggestion above this
would make it easier to check for this kind of bug.


> P.S.: I just *knew* that at least one other for loop in Wine would be wrong,
> too ;-)

   Yep, I should have done that myself (if you find a generic bug,
always check for other similar bugs).


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                  In a world without fences who needs Gates?





More information about the wine-devel mailing list