Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1641742

RE: [PATCH 1/3] Fix ERROR: trailing statements should be on next line

From David Laight <David.Laight@ACULAB.COM>
Newsgroups linux.kernel
Subject RE: [PATCH 1/3] Fix ERROR: trailing statements should be on next line
Date 2017-05-15 16:30 +0200
Message-ID <tHpay-Ra-19@gated-at.bofh.it> (permalink)
References <tH5Ye-4E8-5@gated-at.bofh.it> <tHeoN-1YZ-7@gated-at.bofh.it> <tHeRQ-2oS-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Alex Williamson
> Sent: 15 May 2017 04:21
...
> > >  	/* Find end of list, sew whole thing into vi->rq.pages. */
> > > -	for (end = page; end->private; end = (struct page *)end->private);
> > > +	for (end = page; end->private; end = (struct page *)end->private)
> > > +		;
> 
> FWIW, I generally like to put a comment on the next line to make it
> abundantly clear that there's nothing in the body of the loop, it's
> also more aesthetically pleasing than a semi-colon on the line by
> itself, ex. /* Nothing */;  It's just too easy to misinterpret the
> loop otherwise, especially without gratuitous white space.  Thanks,

My preference is to put 'continue;' on a line by itself.
Or even move the termination condition into the loop:
	for (end = page;; end = (struct page *)end->private)
		if (!end->private)
			break;

(oh, is that cast needed??)

	David

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] Fix ERROR: trailing statements should be on next line Maciek Fijalkowski <macfij7@wp.pl> - 2017-05-14 20:00 +0200
  Re: [PATCH 1/3] Fix ERROR: trailing statements should be on next line "Michael S. Tsirkin" <mst@redhat.com> - 2017-05-15 05:00 +0200
    Re: [PATCH 1/3] Fix ERROR: trailing statements should be on next  line Alex Williamson <alex.williamson@redhat.com> - 2017-05-15 05:30 +0200
      RE: [PATCH 1/3] Fix ERROR: trailing statements should be on next  line David Laight <David.Laight@ACULAB.COM> - 2017-05-15 16:30 +0200

csiph-web