Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 May 2021 14:28:05 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Konstantin Belousov <kib@freebsd.org>, dev-commits-src-main@freebsd.org
Subject:   Re: git: effc8e57fbf0 - main - libalias: Style cleanup
Message-ID:  <A568EC28-FCFA-4498-9DEA-F9382316794F@yahoo.com>
References:  <A568EC28-FCFA-4498-9DEA-F9382316794F.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.


=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A568EC28-FCFA-4498-9DEA-F9382316794F>