[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3e98198c-ff6e-4166-ad7f-3a258acc225f@kernel.org>
Date: Wed, 7 Jan 2026 13:29:07 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Alexey Dobriyan <adobriyan@...il.com>, corbet@....net
Cc: workflows@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 8/9] CodingStyle: tell people how to split long "for"
loops
On 09/05/2025 22:34, Alexey Dobriyan wrote:
> Signed-off-by: Alexey Dobriyan <adobriyan@...il.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.
NAK. Very long loops should simply not be written.
Best regards,
Krzysztof
Powered by blists - more mailing lists