On Tue, Jun 16, 2020 at 8:33 PM Ian Lepore <i...@freebsd.org> wrote: > On Tue, 2020-06-16 at 19:34 +0200, Kristof Provost wrote: > > On 16 Jun 2020, at 19:11, Ed Maste wrote: > > > On Tue, 16 Jun 2020 at 13:01, Ian Lepore <i...@freebsd.org> wrote: > > > > > > > > As much as I prefer doing it this way, style(9) doesn't allow for > > > > variable declarations inside a for() statement (or even inside a > > > > local > > > > block, which is just too 1980s for me, but it is still our standard). > > > > > > Perhaps it's time to update style(9) to at least permit these uses, as > > > we've done with the blank line at the beginning of functions with no > > > local variables, and with braces around single-line bodies. > > > > We have 431 instances of `for (int i` in sys alone. It’s not so much a > > question of allowing it as acknowledging reality at this point. > > > > Best regards, > > Kristof > > Hmm, so we do. If you weed out sys/contrib, and device drivers > contributed by vendors, the number is a lot smaller, but still big > enough that we should just change the rules I think. >
We should definitely just change the rules. There's no point in prohibiting it. Contributors have already voted with their feet diff --git a/share/man/man9/style.9 b/share/man/man9/style.9 index 4e801bbcbe70..fd23d573eb00 100644 --- a/share/man/man9/style.9 +++ b/share/man/man9/style.9 @@ -592,8 +592,6 @@ not Parts of a .Ic for loop may be left empty. -Do not put declarations -inside blocks unless the routine is unusually complicated. .Bd -literal for (; cnt < 15; cnt++) { stmt1; Although the block doesn't start until { so int i; in the commit technically doesn't violate this rule. We violate it in dozens of other ways than this. Warner _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"