But while on the subject, I can't help bringing up the QEMU coding style[0]:
> Some people like to tile their 24” screens with a 6x4 matrix of 80x24 xterms and use vi in all of them. The best way to punish them is to let them keep doing it.
[0]: https://qemu-project.gitlab.io/qemu/devel/style.html#line-wi...
Also, for reference, a table of font sizes and number of terminals beside each other that fit on a given size screen:
1t 2t 3t 4t 5t 6t
6px 480 960 1440 1920 2400 2880
7px 560 1120 1680 2240 2800 3360
8px 640 1280 1920 2560 3200 3840
9px 720 1440 2160 2880 3600 4320
10px 800 1600 2400 3200 4000 4800
12px 960 1920 2880 3840 4800 5760
14px 1120 2240 3360 4480 5600 6720
16px 1280 2560 3840 5120 6400 7680
On a screen with the traditional ~100 DPI, a 6px wide font is quite readable so on 1920x1080 you get exactly 4 columns of terminals (just beware window decorations trying to steal extra pixels). If the height is 13px (so it's about a 9.5pt font IF point size is measured honestly) you get about 75 lines depending on taskbar and window headers.Even if some lines are long, a lot of lines are short. So the end-of-line side of a text editor is less densely used than the start of line side. This may not show too much with 80 columns line, but with longer lines one can notice that the end-of-line space is mostly blank, with low information density.
So instead of using long lines, I'm using 80 columns lines but with several (3 in practice) text panes in parallel. Basically, my work set-up is 3 columns of text panes, with 80 columns of characters each. That allows working on a module body with its header still visible, and the header of another used module shown too. Or to see two different parts of the same file easily (head with declaration, bottom with code). In other words, it's easy to find productive use for 3 parallel text panes. And each one is "information dense".
I'd like to have a little more than 80 columns. 100 would be a good number (higher waste space on the EOL side). But with this I can't fit 3 parallel panes on some screen. So I stick with 80 characters, which is OK too. 80 characters can be annoying when manually formatting code, but when using an automatic formatter (clang-format, yapf, black...) it's not such a big deal.
Anyway, there's a big subjective part in this so just use what's fine by you (and your team). Still, the information density part is an objective thing. So if you can use 3 parallel text panes with your editor, I suggest you try it. That may make you stick to 80 chars too, and not only for historical reasons ;)
The absolute line length should not be subject to a hard limit.
This is because code indents:
------
-----
-----
------
------
------
What I don't want to be obnoxiously long is any of the ----- content itself, regardless of how much or how little indentation is in front of it.I don't like ridiculous nesting, but imposing some hard limit like 80 columns or 100 is counterproductive; let that naturally limit itself.
When confronted with these limits, programmers do ugly things, like start using shorter and shorter lines at deeper nesting levels, those lines being awkwardly split to fit:
fun(arg, // 80th column here
arg, //
term + //
term + //
term); //
Please, just go over 80 and write fun(arg, arg, term + term + term)!The counterargument is that if you ever have to produce hard copy, it's good if the code sticks to reasonable number of columns. I think we are past the era where people bring hardcopies of code to code reviews, though. We also care about code histories a lot more; printing out a program on paper is no longer considered a viable way to preserve it for future generations, since it loses the change history.
This seems common in Python using a combination of black to do the formatting and flake8 to enforce it. It works well in almost all cases. I've not encountered many situations where one could argue >88 chars leads to the most readable code.