Skip to contentSkip to conversation

checkpatch.pl: remove the 80 charactes punch card limit

PATCH NAK Stefani Seibold 9 participants 13 messages Jan 27, 2010 – Feb 1, 2010 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch.pl: remove the 80 charactes punch card limit

The time of 80 characters punch card and terminals are over, so i would be a good thing to set the line length limit to 120. Every display today should be able handle this.

---
 checkpatch.pl |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
@@ -1374,13 +1374,13 @@ sub process {
 # check we are in a valid source file if not then ignore this hunk
 		next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
 
-#80 column limit
+#120 column limit
 		if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
 		    $rawline !~ /^.\s*\*\s*\@$Ident\s/ &&
 		    $line !~ /^\+\s*printk\s*\(\s*(?:KERN_\S+\s*)?"[X\t]*"\s*(?:,|\)\s*;)\s*$/ &&
-		    $length > 80)
+		    $length > 120)
 		{
-			WARN("line over 80 characters\n" . $herecurr);
+			WARN("line over 120 characters\n" . $herecurr);
 		}
 
 # check for adding lines without a newline.
#1 lore raw
Quoted 5 lines

The time of 80 characters punch card and terminals are over, so i would be a good thing to set the line length limit to 120. Every display today should be able handle this.

Nack.

While the origins of 80 character lines dates back to punchcards there is a reason it has survived the test of time. Lines that go longer are hard to comprehend. Either they are long themselves, in which case breaking them up into smaller chunks on multiple lines helps readability, or they are starting from deep indentation, in which case the function should be refactored or broken up so the logic is more digestable.

#2 lore raw
Quoted 7 lines · Joel Schopp
Quoted 4 lines

The time of 80 characters punch card and terminals are over, so i would be a good thing to set the line length limit to 120. Every display today should be able handle this.

Nack.

While the origins of 80 character lines dates back to punchcards there is a reason it has survived the test of time.

Has it though? If that were the undisputed truth, we wouldn't be having this discussion. Also it is likely that there would be very few devices capable of displaying more than 80 columns.

Quoted 1 line

Lines that go longer are hard to comprehend.

Not universally.

Quoted 1 line

Either they are long themselves, in which case breaking them up into smaller chunks on multiple lines helps readability,

... Or sometimes it results in gibberish.

Quoted 1 line

or they are starting from deep indentation, in which case the function should be refactored or broken up so the logic is more digestable. --

The problem with the checkpatch.pl tool is that its use results in people trying to eliminate warnings. In the case of the 80 column warning, this can result in going against the goal stated in CodingStyle Chapter 2: "Coding style is all about readability and maintainability..."

Perhaps checkpatch.pl needs a third level of diagnostic. Perhaps:

NOTICE: line over 80 characters

Indicating that the line in question should be given extra attention, but weaker than a WARNING.

In any event, it is always fun to discuss these questions of style.

David Daney

#3 lore raw
Quoted 6 lines
Quoted 4 lines

While the origins of 80 character lines dates back to punchcards there is a reason it has survived the test of time.

Has it though? If that were the undisputed truth, we wouldn't be having this discussion.

If you know of a usability study that quantifies the effect of line length on readibility of C code I'm willing to listen, and I'm sure others are too.

#4 lore raw
Quoted 8 lines · Joel Schopp
Quoted 6 lines
Quoted 4 lines

While the origins of 80 character lines dates back to punchcards there is a reason it has survived the test of time.

Has it though? If that were the undisputed truth, we wouldn't be having this discussion.

If you know of a usability study that quantifies the effect of line length on readibility of C code I'm willing to listen, and I'm sure others are too.

Good point. As with most things related to kernel development, a usability study or other market research from a reputable institution is a vital first step before taking any action.

We don't have any good peer reviewed research on the subject that I am aware of. I guess even contemplating a change at this early point would be rash and dangerous.

I withdraw my previous comments with respect to the 80 Column Question.
Instead I would recommend elevating the WARNING to ERROR status.

David Daney

#5 lore raw
In reply to Joel Schopp

Am Mittwoch, den 27.01.2010, 14:31 -0600 schrieb Joel Schopp:

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

While the origins of 80 character lines dates back to punchcards there is a reason it has survived the test of time.

Has it though? If that were the undisputed truth, we wouldn't be having this discussion.

If you know of a usability study that quantifies the effect of line length on readibility of C code I'm willing to listen, and I'm sure others are too.

Show me the usability study with claims that 80 columns is the wisdom in software engineering. Why not 73, 90 or 95? The only reason for the 80 columns is a historic one.

And the programming rules for linux doesn't manifest the 80 character per line.

Code will get in many cases harder to read, especially together with the tab size of 8. Multiline C statements makes the code IMHO harder to read.

Stefani

#12 lore raw
In reply to Stefani Seibold
Quoted 3 lines · Stefani Seibold

The time of 80 characters punch card and terminals are over, so i would be a good thing to set the line length limit to 120. Every display today should be able handle this.

I thought it's been already agreed that the limit is lifted altogether? Not even the 132 that was considered by some people sane enough.

The other thing is that fine "code complexity", but I think checkpatch can't check it ATM, can it?

Signature · 1 line
Krzysztof Halasa
#7 lore raw
In reply to Andi Kleen
Quoted 11 lines · Andi Kleen
Quoted 5 lines · Stefani Seibold

The time of 80 characters punch card and terminals are over, so i would be a good thing to set the line length limit to 120. Every display today should be able handle this.

Full Ack!

-Andi

I agree, but if people still have problems with it, perhaps reevaluating Joe Perches' patch:

http://lkml.org/lkml/2009/12/18/3

could be an alternative.

David Daney

#8 lore raw
In reply to Andi Kleen
Quoted 9 lines · Andi Kleen
Quoted 6 lines

The time of 80 characters punch card and terminals are over, so i would be a good thing to set the line length limit to 120. Every display today should be able handle this.

Full Ack!

NACK Attack!

There is a reason Knuth only put so many words on a line with TeX.

Eugh.

Cheers

Signature · 2 lines
Alexander Clouter
.sigmonster says: Keep out of reach of children.
#9 lore raw
Quoted 6 lines · Alexander Clouter
Quoted 5 lines · Andi Kleen
Quoted 5 lines

The time of 80 characters punch card and terminals are over, so i would be a good thing to set the line length limit to 120. Every display today should be able handle this.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Full Ack!

NACK Attack!

There is a reason Knuth only put so many words on a line with TeX.

Linus has already agreed that the 80 character limit is stupid. Let's just nuke this check from checkpatch.pl and move on.

- Ted

maintainer
#10 lore raw
Quoted 2 lines · On Fri, 2010-01-29 at 00:19 -0500, [email protected] wrote:

Linus has already agreed that the 80 character limit is stupid. Let's just nuke this check from checkpatch.pl and move on.

Andy, can you update checkpatch please?

I proposed this: http://lkml.org/lkml/2009/12/18/3

If you're too busy, I can collect the several
additional patches that have been suggested and
push them to you or to Andrew Morton.

#11 lore raw
In reply to Alexander Clouter
Quoted 5 lines · Alexander Clouter
Quoted 4 lines · Andi Kleen
Quoted 4 lines

The time of 80 characters punch card and terminals are over, so i would be a good thing to set the line length limit to 120. Every display today should be able handle this.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Full Ack!

NACK Attack!

There is a reason Knuth only put so many words on a line with TeX.

If you're going to cite Knuth as a reason for the 80 character per line limit, you should understand the difference between ribbon length and line length.

While there are good reasons to constrain the number of characters in a ribbon, and to prohibit too much of a shift in indentation between two neighbouring lines, there's no particularly strong readability reason to limit a line to 80 characters.

Thus, assuming that maintainers read the patches they're sent, and apply a bit of common sense (insisting on sensibly sized ribbons, and getting grouchy about deep indentation), an 80 character line length limit isn't needed.

Signature · 1 line
Simon