Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Josh Triplett and committed by
Linus Torvalds
6f76b6fc 1117f72e

+6 -15
+6 -15
Documentation/CodingStyle
··· 80 80 The limit on the length of lines is 80 columns and this is a strongly 81 81 preferred limit. 82 82 83 - Statements longer than 80 columns will be broken into sensible chunks. 84 - Descendants are always substantially shorter than the parent and are placed 85 - substantially to the right. The same applies to function headers with a long 86 - argument list. Long strings are as well broken into shorter strings. The 87 - only exception to this is where exceeding 80 columns significantly increases 88 - readability and does not hide information. 83 + Statements longer than 80 columns will be broken into sensible chunks, unless 84 + exceeding 80 columns significantly increases readability and does not hide 85 + information. Descendants are always substantially shorter than the parent and 86 + are placed substantially to the right. The same applies to function headers 87 + with a long argument list. However, never break user-visible strings such as 88 + printk messages, because that breaks the ability to grep for them. 89 89 90 - void 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 91 Chapter 3: Placing Braces and Spaces 101 92