Should you limit the width of your source code? You can’t read code
that goes off the edge of your screen. So your font size, resolution
and monitor all combine to produce a point at which you must break (or
at least wrap) your lines of code.
I don’t like wrapping. Lines of arbitrary length that wrap wherever
I happen to have positioned the right-hand side of my window seem
Even if you have plenty of room for more columns, standardising on a smaller number means that when reviewing code
you can see changes side by side using a difference viewer.
Given that I am going to insert a line break somewhere in my code,
where should it go?
There are many possible answers.
COBOL allows approximately 66 characters for code (72 columns – space
for line numbers).
Fortran has 72 usable columns from a maximum of 80.
xterm and gnome-terminal (among others) open 80 columns wide by
default. So does emacs.
vim allows 8 columns for line numbers, leaving 72 usable columns on
a standard terminal.
80 columns was built in to Apple //e motherboard.
4.1 Line Length
Avoid lines longer than 80 characters, since they’re not handled well by many terminals and tools.
Note: Examples for use in documentation should have a shorter line length-generally no more than 70 characters.
The linux kernel seems to mostly be broken at 80 columns but there are plenty of exceptions (91-column example):
File: linux/drivers/firmware/efivars.c Line: 749
printk(KERN_ERR "efivars: Sysfs attribute export failed with error %d. ", error);
Some people definitely go wider than 80 columns.
If you want to be able to “> ” quote in an email on an 80-column terminal without wrapping, you’ll have to limit yourself to 78, or less for nested quoting.
72 and 80 seem to have originated with punch cards, but are by far the most common standard. So, is 72 or 80 columns old-fashioned? Pointlessly restrictive? Or is it the One True Way? Make a comment and let me know what you think!