Commit 6f76b6fc authored by Josh Triplett's avatar Josh Triplett Committed by Linus Torvalds

CodingStyle: Document the exception of not splitting user-visible strings, for grepping

Patch reviewers now recommend not splitting long user-visible strings,
such as printk messages, even if they exceed 80 columns.  This avoids
breaking grep.  However, that recommendation did not actually appear
anywhere in Documentation/CodingStyle.

See, for example, the thread at
  http://news.gmane.org/find-root.php?message_id=%3c1312215262.11635.15.camel%40Joe%2dLaptop%3eSigned-off-by: default avatarJosh Triplett <josh@joshtriplett.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1117f72e
...@@ -80,22 +80,13 @@ available tools. ...@@ -80,22 +80,13 @@ available tools.
The limit on the length of lines is 80 columns and this is a strongly The limit on the length of lines is 80 columns and this is a strongly
preferred limit. preferred limit.
Statements longer than 80 columns will be broken into sensible chunks. Statements longer than 80 columns will be broken into sensible chunks, unless
Descendants are always substantially shorter than the parent and are placed exceeding 80 columns significantly increases readability and does not hide
substantially to the right. The same applies to function headers with a long information. Descendants are always substantially shorter than the parent and
argument list. Long strings are as well broken into shorter strings. The are placed substantially to the right. The same applies to function headers
only exception to this is where exceeding 80 columns significantly increases with a long argument list. However, never break user-visible strings such as
readability and does not hide information. printk messages, because that breaks the ability to grep for them.
void fun(int a, int b, int c)
{
if (condition)
printk(KERN_WARNING "Warning this is a long printk with "
"3 parameters a: %u b: %u "
"c: %u \n", a, b, c);
else
next_statement;
}
Chapter 3: Placing Braces and Spaces Chapter 3: Placing Braces and Spaces
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment