On Mon, 12 May 2025 19:20:23 +0300
Alexey Dobriyan <adobri...@gmail.com> wrote:

> On Sat, May 10, 2025 at 07:56:03PM +0100, David Laight wrote:
> > On Fri,  9 May 2025 23:34:29 +0300
> > Alexey Dobriyan <adobri...@gmail.com> wrote:
> >   
> > > Signed-off-by: Alexey Dobriyan <adobri...@gmail.com>
> > > ---
> > >  Documentation/process/coding-style.rst | 16 +++++++++++++++-
> > >  1 file changed, 15 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/Documentation/process/coding-style.rst 
> > > b/Documentation/process/coding-style.rst
> > > index e17de69845ff..494ab3201112 100644
> > > --- a/Documentation/process/coding-style.rst
> > > +++ b/Documentation/process/coding-style.rst
> > > @@ -183,7 +183,21 @@ Descendants are always substantially shorter than 
> > > the parent and
> > >  are placed substantially to the right.  A very commonly used style
> > >  is to align descendants to a function open parenthesis.
> > >  
> > > -These same rules are applied to function headers with a long argument 
> > > list.
> > > +These same rules are applied to function prototypes with a long argument 
> > > list.
> > > +
> > > +Very long ``for`` loops are split at the ``;`` characters making it 
> > > easier
> > > +to see which code goes to which clause:
> > > +
> > > +.. code-block:: c
> > > +
> > > + for (int i = 0;
> > > +      i < N;
> > > +      i += 1)
> > > + {
> > > + }
> > > +
> > > +Opening curly is placed on a separate line then to make it easier to tell
> > > +loop body from iteration clause.  
> > 
> > Is that actually the style - I don't remember seeing it.  
> 
> Check include/linux/list.h.
> 
> The point here is that it is either 1 line or 3 (not 2).
> If you start splitting for loop there are 2 obvious points to do so.

Yes, and there is absolutely no reason to always use both of them.
You do want to split at 'low priority' operators rather than just at
80 columns - but that is always true.

        David
 

        David


Reply via email to