git: effc8e57fbf0 - main - libalias: Style cleanup
Mark Millard
marklmi at yahoo.com
Sat May 15 21:28:12 UTC 2021
Konstantin Belousov kostikbel at gmail.com wrote on
Sat May 15 19:42:08 UTC 2021 :
> On Sat, May 15, 2021 at 07:01:07AM +0000, Lutz Donnerhacke wrote:
> > . . .
> > +static int
> > +IcmpAliasIn1(struct libalias *la, struct ip *pip)
> > +{
> > + LIBALIAS_LOCK_ASSERT(la);
> > struct alias_link *lnk;
> > struct icmp *ic;
> And this is not in style. Declarations must precede executable statements,
> even asserts.
Looks like the "may be placed" wording in "man 9 style"
below might need adjustment in the first paragraph
quoted. The beginning of a function is an example of a
block and I got a rather different interpretation of the
wording out of reading the material as it is: I read it
as indicating an optional status for such a placement of
declarations in blocks generally.
QUOTE
When declaring variables in functions declare them sorted by size, then
in alphabetical order; multiple ones per line are okay. If a line
overflows reuse the type keyword. Variables may be initialized where
declared especially when they are constant for the rest of the scope.
Declarations may be placed before executable lines at the start of any
block. Calls to complicated functions should be avoided when
initializing variables.
. . .
Do not insert a blank line at the beginning of functions with local
variables. Instead, these should have local variable declarations first,
followed by one blank line, followed by the first statement.
END QUOTE
In the second paragraph quoted, the "should have" possibly
should be "must have". Having read the other wording first,
and misinterpreted, I apparently read too much optionality
into "should have" as well.
===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)
More information about the dev-commits-src-main
mailing list