svn commit: r327354 - head/sys/vm

Warner Losh imp at bsdimp.com
Thu Jan 18 21:15:19 UTC 2018


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

> On Thu, Jan 18, 2018 at 1:04 PM, Warner Losh <imp at 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


More information about the svn-src-all mailing list