Date: Wed, 27 Dec 2023 08:48:16 -0700 From: Warner Losh <imp@bsdimp.com> To: Alexey Dokuchaev <danfe@freebsd.org> Cc: Konstantin Belousov <kostikbel@gmail.com>, Kyle Evans <kevans@freebsd.org>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 6ac7c9f06ae9 - main - daemon: remove redundant parameter from listen_child() Message-ID: <CANCZdfqhdx9mG2zogBQEz3%2BAGTrf7F7bConf-b4R40BjzH6MqA@mail.gmail.com> In-Reply-To: <ZYxDXbj50bjYrxC0@FreeBSD.org> References: <202312270608.3BR688vs024888@gitrepo.freebsd.org> <ZYw5cGZAuLSbO8AW@kib.kiev.ua> <ZYxDXbj50bjYrxC0@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On Wed, Dec 27, 2023 at 8:31 AM Alexey Dokuchaev <danfe@freebsd.org> wrote: > On Wed, Dec 27, 2023 at 04:49:20PM +0200, Konstantin Belousov wrote: > > On Wed, Dec 27, 2023 at 06:08:08AM +0000, Kyle Evans wrote: > > > commit 6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7 > > > > > > daemon: remove redundant parameter from listen_child() > > > > > > state already contains pipe fd > > > ... > > > @@ -448,9 +448,7 @@ daemon_eventloop(struct daemon_state *state) > > > /* child is dead, read all until > EOF */ > > > state->pid = -1; > > > state->mode = MODE_NOCHILD; > > > - while > (listen_child(state->pipe_fd[0], > > > - state)) > > > - ; > > > + while (listen_child(state)); > > > > This line is the style regression. > > We've seen this before and I reckon these regressions would keep happening > when semicolon is put on the new line by itself alone. This would be less > likely to happen and makes the intention more obvious to say ``continue;''. > fwiw, that was the recommendation of the 'old unix hands' on USENET in the mid 80s. It made the intention clear. I was told, but never encountered, that some linting tools will warn about the above style but not while (foo) continue; and so that's been my personal style ever since. I've debugged lots of code that used this style, and it's a bugger to sort out if the indentation is correct and the ; is intended at the end of the line, or if it was intended... Warner [-- Attachment #2 --] <div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 27, 2023 at 8:31 AM Alexey Dokuchaev <<a href="mailto:danfe@freebsd.org">danfe@freebsd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, Dec 27, 2023 at 04:49:20PM +0200, Konstantin Belousov wrote:<br> > On Wed, Dec 27, 2023 at 06:08:08AM +0000, Kyle Evans wrote:<br> > > commit 6ac7c9f06ae9b7ef070c1f8a57dcc52be4dd45b7<br> > > <br> > > daemon: remove redundant parameter from listen_child()<br> > > <br> > > state already contains pipe fd<br> > > ...<br> > > @@ -448,9 +448,7 @@ daemon_eventloop(struct daemon_state *state)<br> > > /* child is dead, read all until EOF */<br> > > state->pid = -1;<br> > > state->mode = MODE_NOCHILD;<br> > > - while (listen_child(state->pipe_fd[0],<br> > > - state))<br> > > - ;<br> > > + while (listen_child(state));<br> > <br> > This line is the style regression.<br> <br> We've seen this before and I reckon these regressions would keep happening<br> when semicolon is put on the new line by itself alone. This would be less<br> likely to happen and makes the intention more obvious to say ``continue;''.<br></blockquote><div><br></div><div>fwiw, that was the recommendation of the 'old unix hands' on USENET</div><div>in the mid 80s. It made the intention clear. I was told, but never encountered,</div><div>that some linting tools will warn about the above style but not while (foo) continue;</div><div>and so that's been my personal style ever since. I've debugged lots of code that</div><div>used this style, and it's a bugger to sort out if the indentation is correct and the ;</div><div>is intended at the end of the line, or if it was intended...</div><div><br></div><div>Warner</div></div></div>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqhdx9mG2zogBQEz3%2BAGTrf7F7bConf-b4R40BjzH6MqA>
