[TUHS] tabs vs spaces - entab, detab

Steffen Nurpmeso steffen at sdaoden.eu
Sat Mar 6 00:13:48 AEST 2021


Greg 'groggy' Lehey wrote in
 <20210304221250.GD6303 at eureka.lemis.com>:
 |On Thursday,  4 March 2021 at 23:08:53 +0100, Andy Kosela wrote:
 |>
 |> From Linux kernel coding style doc:
 |> "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."
 |
 |:-)

I for one happily left tabulators behind.  But for make files.
The reason to use tab was file size for one, and that each editor
could be used interchangeably to work easily (backspace stepping
a real level, for example), and the reason for tab/8 was that the
files looked the same everywhere, on the printer, on the terminal
via cat(1), less(1), etc., so playing with vim(1)s tabstop
etc. setting was a fruitless dead-end.

On the 80 columns that i use, that i happily use, i just read
wireguard-tools source code (i am in the process of becoming
a hundred percent Wireguard fan, someone sat down and did
something really great i think) and even though it fits my screen,
it is just terrible to see lines that long (the kernel code fits
80, yay, not that i understand where all the work happens),
tabulators just cause crowding on the right, and then .. that
cannot be right.

Even though my coding style is easy not like that Linux kernel
code where function call arguments are then aligned under the
( +1, which ... no!  Well.  I switched to spaces when working for
free.  :)
But, not important.  A real change to my coding style came when
i looked around Plan9 source code, the pragmatism to simply not
use spaces in language constructs aka statements at all, for
example "if(a){" instead of "if(a) {" or "if (a) {", and let alone
"if (a)\nALIGN{\nALIGN" and whatever else.  I like that.  You
know, FreeBSD is thinking about using that clang format thing in
commit hooks (and maybe many even use the clangd "live" ctags),
and that was written in Acme or even Sam.  And the manuals were
great and the C dialect was, too.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the TUHS mailing list