aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/CodingStyle
diff options
context:
space:
mode:
authorJosh Triplett <josh@joshtriplett.org>2011-08-03 15:19:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-08-06 14:59:07 -0400
commit6f76b6fcaa6025bc9b2c00e055c7ccd39730568d (patch)
tree1b34503081591f2a5748c0902e6e75f917de070b /Documentation/CodingStyle
parent1117f72ea0217ba0cc19f05adbbd8b9a397f5ab7 (diff)
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%3e Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/CodingStyle')
-rw-r--r--Documentation/CodingStyle23
1 files changed, 7 insertions, 16 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index fa6e25b94a54..c940239d9678 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -80,22 +80,13 @@ available tools.
80The limit on the length of lines is 80 columns and this is a strongly 80The limit on the length of lines is 80 columns and this is a strongly
81preferred limit. 81preferred limit.
82 82
83Statements longer than 80 columns will be broken into sensible chunks. 83Statements longer than 80 columns will be broken into sensible chunks, unless
84Descendants are always substantially shorter than the parent and are placed 84exceeding 80 columns significantly increases readability and does not hide
85substantially to the right. The same applies to function headers with a long 85information. Descendants are always substantially shorter than the parent and
86argument list. Long strings are as well broken into shorter strings. The 86are placed substantially to the right. The same applies to function headers
87only exception to this is where exceeding 80 columns significantly increases 87with a long argument list. However, never break user-visible strings such as
88readability and does not hide information. 88printk messages, because that breaks the ability to grep for them.
89 89
90void fun(int a, int b, int c)
91{
92 if (condition)
93 printk(KERN_WARNING "Warning this is a long printk with "
94 "3 parameters a: %u b: %u "
95 "c: %u \n", a, b, c);
96 else
97 next_statement;
98}
99 90
100 Chapter 3: Placing Braces and Spaces 91 Chapter 3: Placing Braces and Spaces
101 92