On Fri, Jul 31, 2020 at 10:55 AM Gregory Nutt <spudan...@gmail.com> wrote:
> > Hmmm... I don't agree.
> >
> > The Coding Standard encourages empty "while loops":
> > https://cwiki.apache.org/confluence/display/NUTTX/Coding+Standard#while
> > Why should this not applicable for "for loops"? I think there are many 
> > already in the tree.
> Actually, I think that is an error in the coding document.  At least, it
> is certainly NOT incorrect to use braces after while as the example
> suggests.  It should be encouraged but it is not required.  Perhaps it
> should be required to use braces always?

Before we change the coding standard, I suggest that we get more
feedback from the dev community.

My opinion: If a loop does not require a body, I suggest to use
braces, rather than a semicolon, because it is less prone to
programmer error. I would be okay with either:

while (condition)
  {
  }

or

while (condition) {}

And of the two, I think the second one expresses the intent best.

But again: I'd like to see more feedback from the community first.

Nathan

Reply via email to