Date: Thu, 18 Jan 2018 14:15:16 -0700 From: Warner Losh <imp@bsdimp.com> To: Matt Joras <mjoras@freebsd.org> Cc: "Conrad E. Meyer" <cem@freebsd.org>, Eric van Gyzen <eric@vangyzen.net>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r327354 - head/sys/vm Message-ID: <CANCZdfrL2yXh5gqiRO4zoCOBnrgk12zQw4mQ7Bu3NZyNeVZZTQ@mail.gmail.com> In-Reply-To: <CADdTf%2Bgr7mn-8snR1gvV1weDMhnhuKs85_DbMTe%2B-RVOkO1nQw@mail.gmail.com> References: <201712291905.vBTJ57gI072871@repo.freebsd.org> <20180117224054.GO8113@FreeBSD.org> <601ee1a2-8f4e-518d-4c86-89871cd652af@vangyzen.net> <CAG6CVpVuXUcPCX81Nv9XujRVw8psxpLSLRfG9T20w6sr4j6=PA@mail.gmail.com> <CANCZdfosA5%2BU=7vsULp2fQy_=e7TTZ5Qs2BNtHuONONg_Qdegw@mail.gmail.com> <CADdTf%2Bgr7mn-8snR1gvV1weDMhnhuKs85_DbMTe%2B-RVOkO1nQw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 18, 2018 at 2:10 PM, Matt Joras <mjoras@freebsd.org> wrote: > On Thu, Jan 18, 2018 at 1:04 PM, Warner Losh <imp@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrL2yXh5gqiRO4zoCOBnrgk12zQw4mQ7Bu3NZyNeVZZTQ>