for loop fixes
Andreas Mohr
a.mohr at mailto.de
Sun Mar 4 12:38:54 CST 2001
On Sun, Mar 04, 2001 at 06:21:22AM -0600, David Elliott wrote:
> Why, what's wrong with a for loop?
>
> So far we have these choices:
> for(init,test,update); /* original */
> for(init,test,update) ; /* with space */
> init;
> while(test)
> {
> update;
> }
>
> What about simply:
> for(init,test,update)
> ;
>
> Putting the semicolon on the next line indented makes sense IMHO. Solves the
> problem of confusing it with a for loop accidently having a semicolon at the end
> and these kind that intentionally have one and is visible to a human at a very very
> quick glance. The only expense is ONE line.
Yep. I've been thinking of that, too.
> > > > Please do the same for these for loops in the future.
> > >
> > > ???
> > Well, I just meant that they should always use " ;" instead of ";".
> > But your proposal is probably much better.
> >
>
> I dunno, I like mine but shit we are gonna start a really bad coding-style war here
> if we continue with this.
*g*
> > > > 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.
> > Correct.
>
> Just don't specify an indentation style, lest we be stuck with 2 or 3 spaces for an
> indent instead of a nice single 8-space tab (am I the only one here who prefers
> tabs to spaces?)
Yep, specify anything, but please stay far away from indentation rules.
Else the coding style war will strike again...
Personally I prefer 4-spaced indentation in order to prevent 80 char limit
overflow, but that's probably not such a good choice, as you should create
a new function anyway if you get into overflow mode due to tabbed indents.
> As far as specifying using while instead of for, I am not such a big fan of that
> either. Personally I feel whoever is writing the code should decide. Requiring a
> space between the ) and ; or requiring the semicolon on the next line indented once
> more is probably the best way to go. Even an either-or approach on this would be
> acceptable.
ACK.
I just want to make sure that we do NOT have the ); combo usually used for
function call termination, so that it's obvious that the coder intended
something different with this for loop.
Andreas Mohr
More information about the wine-devel
mailing list