News for hackers. Stuff that matters.
Re:C-style: My favorite C programming practices by kleiba on Monday May 20, 2024 @03:04AM (#40413042)
Agree. This 80 character limit stems from a time where terminals could only display comparatively few characters in a line, a limit we haven't had in decades as screen resolutions grew.

Another argument for shorters lines is that it is much harder for us to read any text when lines get too long. There's a reason why we read and write documents in portrait mode, not landscape.

But in sum, I don't think there's a need for creating a hard limit at the 80 character mark. Most code is not indented more than three or four times anyways, and most if not all languages allow you to insert newlines to make long expressions wrap. However, if you occasionally do need to go longer, I think that's completely fine and certainly better than having to bend around an arcane character limit.

Re:C-style: My favorite C programming practices by f1shy on Monday May 20, 2024 @03:50AM (#40413266)
> This 80 character limit stems from a time where terminals could only display comparatively few characters in a line, a limit we haven't had in decades as screen resolutions grew.

The 80 char rule has little to do with old monitors. Has to do with ergonomics, and is why any good edited and typeset book will have between 60 and 80 characters per line.

Re:C-style: My favorite C programming practices by jjgreen on Monday May 20, 2024 @04:33AM (#40413482)
Exactly this. Open a novel and count the characters on a line; around 80 is readable as 500 years of typographic practice has determined. Two or three levels of indentation and that bumps the page width up a bit, still less than 100.
Re:C-style: My favorite C programming practices by ykonstant on Monday May 20, 2024 @04:37AM (#40413500)
It is a fair point, but a book is 60 - 80 characters of dense prose line after line in thick paragraphs; it is not clear how this translates to lines of code.
Re:C-style: My favorite C programming practices by f1shy on Monday May 20, 2024 @11:16AM (#40416469)
In my personal experience (and of couse very subjective) it helps me a lit to have lines that fit the monitor, and I can have 2 parallel windows. Using 120 chars is for me just too much. I do think the golden rule of typography is “all rules can be broken if you know what you are doing”. For me is a soft limit. If splitting a line makes the code less readable, I do allow more. But frankly, that is the case of one in maybe 50k LOC
Re:C-style: My favorite C programming practices by abraae on Monday May 20, 2024 @04:44AM (#40413531)
80 column punched cards were a very strong influence
Re:C-style: My favorite C programming practices by wruza on Monday May 20, 2024 @05:13AM (#40413649)
As a part of ergonomics auditory, I really prefer 100-115 column soft limit for code editors, log viewing and console, because that’s how my single display dev setup works best. Otoh if I’m using IDEs with big sidebars like {X,VS}Code, then I need two displays and/or a full-width IDE anyway.

While I understand that this is an anecdotal preference, to me it doesn’t feel like the 80 column standard fits any modern dev workspace perfectly, tbh. (By modern I don’t mean “shiny”, just what we have now in hw/sw.)

Re:C-style: My favorite C programming practices by jeffdaniels27x on Monday May 20, 2024 @06:49AM (#40414121)
Then let it be 80 characters from any whitespace on the left-hand side? I find it artificially awkward to have to wrap at a hard margin on the right-hand side. Surely you need to accommodate any indenting you're doing?
Re:C-style: My favorite C programming practices by f1shy on Monday May 20, 2024 @11:18AM (#40416499)
Take for example man pages, I find the very comfy to read. And they have generous margins on both sides. About indenting, I try to avoid deep nesting, usually 3 is a maximum, very rare to need more, if the code has to be easy to read.
Re:C-style: My favorite C programming practices by nine_k on Monday May 20, 2024 @07:58AM (#40414487)
Monitors are too new. Punch cards have 80 columns. I think this even pre-dates the use of teletypes with electronic computers.
Re:C-style: My favorite C programming practices by kleiba on Monday May 20, 2024 @02:25PM (#40418469)
It has to do with both and that's why my comment mentions both.

But then again, of course there is a reason why terminals (or punchcards) were made that way - presumably because of reading / writing ergonomics (besides technical reasons).

Re:C-style: My favorite C programming practices by jayd16 on Monday May 20, 2024 @04:12PM (#40419733)
This rules readme isn't even less than 80 characters per line. You're saying we all had trouble reading it?