[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230228222035.k227xb3okt2lbksn@guidai>
Date: Tue, 28 Feb 2023 19:20:35 -0300
From: Bru Moreira-Guedes <codeagain@...eagain.dev>
To: Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Patch Watchbox <patch-reply@...eagain.dev>
Subject: [PATCH] coding-style.rst: indentation: Clarify tabs text
The old text about tabs failed to clearly convey the message that the
TAB character is used for indentation. It also gives the misleading
impression that it's trying to "redefine" what a tab (the 0x09 ASCII
character) is when it says "tabs are 8 characters".
It might be misleading, especially for some autistic readers for whom
English is not the first language and whose tendency to interpret things
more literally might be present (i.e., my very own self).
The present patch clarifies the tabs text on such aspects.
Signed-off-by: Bru Moreira-Guedes <codeagain@...eagain.dev>
---
Documentation/process/coding-style.rst | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst
index 007e49ef6cec..9a0205fa7ed3 100644
--- a/Documentation/process/coding-style.rst
+++ b/Documentation/process/coding-style.rst
@@ -18,23 +18,25 @@ Anyway, here goes:
1) Indentation
--------------
-Tabs are 8 characters, and thus indentations are also 8 characters.
-There are heretic movements that try to make indentations 4 (or even 2!)
-characters deep, and that is akin to trying to define the value of PI to
-be 3.
+The Linux Kernel uses the TAB character for indentation, as in the K&R
+style. Tabs are meant to be viewed as 8-characters, and thus
+indentations are meant to be seen as 8 characters as well. There are
+heretic movements that try to use spaces for indentation, or make tabs
+viewed as 4 (or even 2!) characters, and that is akin to trying to
+define the value of PI to be 5.
Rationale: The whole idea behind indentation is to clearly define where
a block of control starts and ends. Especially when you've been looking
at your screen for 20 straight hours, you'll find it a lot easier to see
how the indentation works if you have large indentations.
-Now, some people will claim that having 8-character indentations makes
+Now, some people will claim that viewint 8-character tab indentations makes
the code move too far to the right, and makes it hard to read on a
80-character terminal screen. The answer to that is that if you need
more than 3 levels of indentation, you're screwed anyway, and should fix
your program.
-In short, 8-char indents make things easier to read, and have the added
+In short, 8-char tab size make things easier to read, and have the added
benefit of warning you when you're nesting your functions too deep.
Heed that warning.
--
2.39.2
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists