On Thu, Jan 18, 2018 at 2:10 PM, Matt Joras <mjo...@freebsd.org> wrote:

> On Thu, Jan 18, 2018 at 1:04 PM, Warner Losh <i...@bsdimp.com> wrote:
> >
> >> 1. Allowing local / block scoped variables
> >> 2. Allowing C99 for loop initial declarations
> >>
> >> But I could see the argument that (2) is just a boring subset of (1).
> >
> >
> > Tell me again where #1/#2 are disallowed? I can't seem to find that in
> > style(9), except by a weak example of there being no examples of #1 or
> #2.
> >
> > Warner
> >
> It is sort of implied by the sections stating the rules for declaring
> variables:
> "When declaring variables in functions declare them sorted by size,
> then n alphabetical order; multiple ones per line are okay."
> And this:
> "/* Insert an empty line if the function has no local variables. */"
>
> I don't see a more explicit note about them.
>

Right. It's a weak argument at best.

The rule I've seen followed is more like "if the function is too big, it's
OK to have scope-local variables." Numerous examples of this can be found
in the tree... More of a "don't do it gratuitously, rather use it only when
it makes good sense."

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"

Reply via email to