linux/Documentation/CodingStyle
<<
>>
Prefs
   1
   2                Linux kernel coding style
   3
   4This is a short document describing the preferred coding style for the
   5linux kernel.  Coding style is very personal, and I won't _force_ my
   6views on anybody, but this is what goes for anything that I have to be
   7able to maintain, and I'd prefer it for most other things too.  Please
   8at least consider the points made here.
   9
  10First off, I'd suggest printing out a copy of the GNU coding standards,
  11and NOT read it.  Burn them, it's a great symbolic gesture.
  12
  13Anyway, here goes:
  14
  15
  16                Chapter 1: Indentation
  17
  18Tabs are 8 characters, and thus indentations are also 8 characters.
  19There are heretic movements that try to make indentations 4 (or even 2!)
  20characters deep, and that is akin to trying to define the value of PI to
  21be 3.
  22
  23Rationale: The whole idea behind indentation is to clearly define where
  24a block of control starts and ends.  Especially when you've been looking
  25at your screen for 20 straight hours, you'll find it a lot easier to see
  26how the indentation works if you have large indentations.
  27
  28Now, some people will claim that having 8-character indentations makes
  29the code move too far to the right, and makes it hard to read on a
  3080-character terminal screen.  The answer to that is that if you need
  31more than 3 levels of indentation, you're screwed anyway, and should fix
  32your program.
  33
  34In short, 8-char indents make things easier to read, and have the added
  35benefit of warning you when you're nesting your functions too deep.
  36Heed that warning.
  37
  38The preferred way to ease multiple indentation levels in a switch statement is
  39to align the "switch" and its subordinate "case" labels in the same column
  40instead of "double-indenting" the "case" labels.  E.g.:
  41
  42        switch (suffix) {
  43        case 'G':
  44        case 'g':
  45                mem <<= 30;
  46                break;
  47        case 'M':
  48        case 'm':
  49                mem <<= 20;
  50                break;
  51        case 'K':
  52        case 'k':
  53                mem <<= 10;
  54                /* fall through */
  55        default:
  56                break;
  57        }
  58
  59
  60Don't put multiple statements on a single line unless you have
  61something to hide:
  62
  63        if (condition) do_this;
  64          do_something_everytime;
  65
  66Don't put multiple assignments on a single line either.  Kernel coding style
  67is super simple.  Avoid tricky expressions.
  68
  69Outside of comments, documentation and except in Kconfig, spaces are never
  70used for indentation, and the above example is deliberately broken.
  71
  72Get a decent editor and don't leave whitespace at the end of lines.
  73
  74
  75                Chapter 2: Breaking long lines and strings
  76
  77Coding style is all about readability and maintainability using commonly
  78available tools.
  79
  80The limit on the length of lines is 80 columns and this is a strongly
  81preferred limit.
  82
  83Statements longer than 80 columns will be broken into sensible chunks.
  84Descendants are always substantially shorter than the parent and are placed
  85substantially to the right. The same applies to function headers with a long
  86argument list. Long strings are as well broken into shorter strings. The
  87only exception to this is where exceeding 80 columns significantly increases
  88readability and does not hide information.
  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
 100                Chapter 3: Placing Braces and Spaces
 101
 102The other issue that always comes up in C styling is the placement of
 103braces.  Unlike the indent size, there are few technical reasons to
 104choose one placement strategy over the other, but the preferred way, as
 105shown to us by the prophets Kernighan and Ritchie, is to put the opening
 106brace last on the line, and put the closing brace first, thusly:
 107
 108        if (x is true) {
 109                we do y
 110        }
 111
 112This applies to all non-function statement blocks (if, switch, for,
 113while, do).  E.g.:
 114
 115        switch (action) {
 116        case KOBJ_ADD:
 117                return "add";
 118        case KOBJ_REMOVE:
 119                return "remove";
 120        case KOBJ_CHANGE:
 121                return "change";
 122        default:
 123                return NULL;
 124        }
 125
 126However, there is one special case, namely functions: they have the
 127opening brace at the beginning of the next line, thus:
 128
 129        int function(int x)
 130        {
 131                body of function
 132        }
 133
 134Heretic people all over the world have claimed that this inconsistency
 135is ...  well ...  inconsistent, but all right-thinking people know that
 136(a) K&R are _right_ and (b) K&R are right.  Besides, functions are
 137special anyway (you can't nest them in C).
 138
 139Note that the closing brace is empty on a line of its own, _except_ in
 140the cases where it is followed by a continuation of the same statement,
 141ie a "while" in a do-statement or an "else" in an if-statement, like
 142this:
 143
 144        do {
 145                body of do-loop
 146        } while (condition);
 147
 148and
 149
 150        if (x == y) {
 151                ..
 152        } else if (x > y) {
 153                ...
 154        } else {
 155                ....
 156        }
 157
 158Rationale: K&R.
 159
 160Also, note that this brace-placement also minimizes the number of empty
 161(or almost empty) lines, without any loss of readability.  Thus, as the
 162supply of new-lines on your screen is not a renewable resource (think
 16325-line terminal screens here), you have more empty lines to put
 164comments on.
 165
 166Do not unnecessarily use braces where a single statement will do.
 167
 168if (condition)
 169        action();
 170
 171This does not apply if one branch of a conditional statement is a single
 172statement. Use braces in )othditionan/CodingStyle#L72" id="L72" class="line"173" id="L173" class="line" name="L173"> 173
 174if (condition) {
 175        do_this();
 176        do_that();
 177} else {
 178        otherwise();
 179}
 180
 181                3.1:  Spaces
 182
 183Linux kernel style for use of spaces depends (mostly) on
 184function-versus-keyword usage.  Use a space after (most) keywords.  The
 185notable exceptions are sizeof, typeof, alignof, and __attribute__, which look
 186somewhat like functions (and are usually used with parentan/es in Linux,
 187although they are not required in the language, as in: "sizeof info" after
 188"struct fileinfo info;" is declared).
 189
 190So use a space after tan/e keywords:
 191        if, switch, case, for, do, while
 192but not with sizeof, typeof, alignof, or __attribute__.  E.g.,
 193        s = sizeof(struct file);
 194
 195Do not add spaces around (inside) parentan/ized expressions.  This example is
 196*bad*:
 197
 198        s = sizeof( struct file );
 199
 200When declaring pointer data or a function that returns a pointer type, the
 201preferred use of '*' is adjacent to the data name or function name and not
 202adjacent to the type name.  Examples:
 203
 204        char *linux_banner;
 205        unsigned long long memparse(char *ptr, char **retptr);
 206        char *match_strdup(substring_t *s);
 207
 208Use one space around (on each side of) most binary and ternary operators,
 209such as any of these:
 210
 211        =  +  -  <  >  *  /  %  |  &  ^  <=  >=  ==  !=  ?  :
 212
 213but no space after unary operators:
 214        &  *  +  -  ~  !  sizeof  typeof  alignof  __attribute__  defined
 215
 216no space before the postfix increment & decrement unary operators:
 217        ++  --
 218
 219no space after the prefix increment & decrement unary operators:
 220        ++  --
 221
 222and no space around the '.' and "->" structure member operators.
 223
 224Do not leave trailing whitespace at the ends of lines.  Some editors with
 225"smart" indentation will insert whitespace at the beginning of new lines as
 226appropriate, so you can start typing the next line of code right away.
 227However, some such editors do not remove the whitespace if you end up not
 228putting a line of code there, such as if you leave a blank line.  As a result,
 229you end up with lines containing trailing whitespace.
 230
 231Git will warn you about patches that introduce trailing whitespace, and can
 232optionally strip the trailing whitespace for you; however, if applying a series
 233of patches, this may make later patches in the series fail by changing their
 234context lines.
 235
 236
 237                Chapter 4: Naming
 238
 239C is a Spartan language, and so should your naming be.  Unlike Modula-2
 240and Pascal programmers, C programmers do not use cute names like
 241ThisVariableIsATemporaryCounter.  A C programmer would call that
 242variable "tmp", which is much easier to write, and not the least more
 243difficult to understand.
 244
 245HOWEVER, while mixed-case names are frowned upon, descriptive names for
 246global variables are a must.  To call a global function "foo" is a
 247shooting offense.
 248
 249GLOBAL variables (to be used only if you _really_ need them) need to
 250have descriptive names, as do global functions.  If you have a function
 251that counts the number of active users, you should call that
 252"count_active_users()" or similar, you should _not_ call it "cntusr()".
 253
 254Encoding the type of a function into the name (so-called Hungarian
 255notation) -placein dsme
<3 59"> 16s3mple rknow sthe type sanyway (nd can
 126 hescktheos, and nt on y ionfiuss the nrogrammer   INowon&er tMicroSof
 127
akes ibuggynrogramm.
 128
 129
LOCL variablesnames fhould _e uhort, 8nd teothe points  If you have  120Aome srnd o in teer toop
countsr, iftfhould _rogbbley_e ualled Hquot;.iquot;.
 121(Clleng tt "coop
_ountsr,quot; is aon-fpoduceive_ if ahere is onochangc of its 122sbeng tmis-nderstaood  Somilar,ly,"tmp",can se ujst.about pny oype of  1232ariablesnhat is tsed oo hiod _a tmporaryCvalue 
 1umentation/Codi2gStyl2#L165"esnames"linefss=ne" ns="29" 9loc"L246" clas="line" criptive nn8" clL149" cl4" class="line"2 CodingStyablesto see
r,quosyndrid=iablesnhat is tsed oo hiod _a tmporaryCvroSof
haquot;struct fileinfo info;" is dec267
 2ition)
 1ion();

 2single
  lang>sbengvps_tountsr, iftfhould _rogbbley_e ualled Hquot;.ionan/Codi2gStyle#L72" id="L72" cla2s="li2e"173" id="L173" class="line" name="L173"> 273
  11_252tid=_L105" on) -pdeforound the  g pointaveW name="ht hTo call a global function "foo"ion) {
 2his();
 2else {
of p-linememeclaL171"1" mean? id="L207" class="line" name="L207"> 2etion)
 29}
 1ayespace for you; however, if applying a 80
 2Spaces
        char *match_strdup(substring_82
 2ly) on
 186 1, iftfhould _rogbbley_e ualled Hquot;.i.  The
 2h look
Do nl ...  on yo class=r,ldefea name=help(or almost eountsr,the> 1oings yd (b) K&R are right.  Besides, functi2Linux,
ix increment & decrement unary oper after
 2ared).
D(66"> 1tion) -pdef<  Toeng t86so105_name_8" id="L68" class="line" name="L68"> 289
 2 while
Dclass="line" ne" nacclasis all1" id="L71" class="line" name="L71"> 2 2
 294
anacclasof '*ed in ths="lineg"li3ofmselvclass="line" name="L234"> 234context ple is
  langine_t etc. 234context pinux,
GLOB<  Tobsoludenta_zero_ g rt srndacclasger t"L88">  88 234context pafter
 2ile );
 1tiona"L209" cla5_nelps_ a0" idame="Las do global functions.  If you have a f399
class="lL40">  4="line" name="L36">  36Heed that wae, the
 3nd not
 id="L101" class="line" name="L101"> 3nogram.
 234context303
 3anner;
  45" class="linline" nat namot;coL11">  no=ke thesal d> id="L101" class="line" name="L101"> 3nrning.
 307
 3these:
owhy" la clas cerame= circlalineame="L181"> 181                3.1: 310
  45" class=cntme="L25 222 clas "L102"e of cur     s"myou cbe="L181"> 181                3.1: 31d not
  45" class="linline" nat nam140" clmeanseg" a to 5 222 "L190) -pdefass="line" name="L234"> 234context312
 3ators:
 234context31ptr);
 3ators:
 3a7
 234context31tors,
 3ators:
 am namclassimeo"Le eye 9" id="L79" class="line" name="L79"> 3a0
11">ucnt32_"L11">h as if you leave a blank line.  As a 321

LOCie" namcein dass="line" name="L234"> 234context3ators.
 323
11">u8/u16/u32/u64L222">) -placedlater patches in the series fail by changin3s with
 234context3nes as
 164comme3up not
 3esult,
 104 ses aon-fpoduceive_ if ahere is onochang3space.
/a>
LOCLexis""L61lhoic233od="L2doass="line" name="L234"> 234context330
 3nd can
 3 their
and Pne" name=u32L222">88">/"L70".ty) linwoss="line" name="L234"> 234context335
&ss="line" name="L234"> 234context33tors:
 338
 103 3dula-2
 234context3s like
 3l that
od="has el spacacter tne" ke the srn id="L101" class="line" name="L101"> 3leries
 234context3stand.
 344
 3es for
ha id="L235" class="line" name="L235"> 3etors:
 3fense.
hane" name="L129">ysme="wee> 129 3f8
wo="line"ful>Do n="L23( oneISO/ANSIe="L162"L214op
_80x24h as if you leave a blank line.  As a 3eed to
  illoa>no) 129 234context3nction
 3l that
ss=e="a>
LOC id="L101" class="line" name="L101"> 3leries
 lexi8" clasline" name="ly slss="12a class="liave t,9"> 249 3ltand.
 186<"na..  0"> 200Whe5lserstaolas"line(oose"na.. ass="line" name="L168"> 168if (con3garian
 1249s"lt>Do nsmnts th34"> f="L20"lty,"tmp",can se ujst.about pny 3nd can
L11">  OKe" naive na"linef '*&#ass="line" name="L234"> 234context3ntors:
 3gramm.
 lex '*&# 129tu id=am>od="n id="L101" class="line" name="L101"> 3l8
ay s= id="L236" class="line" name="L236"> 3u have  24od  , that coad6"> 1t>
LOC id="L101" class="line" name="L101"> 3quot;.
 2 cla/a>25ss="ent"L184">nelpef '*&#hitespace at the ends of lines.  Some edito3 of its 255L11">  berf8"> d c-whi  Unlclass="li"L231Aome srndd>sa bet/a>Djobot; is aon-fpoduceive_ if ahere is onochang3value 
 id="Lolaquot;struct fileinfo info;" is dec3snhaou sh3uld86"> 1umentation/Codi3gStyl3#L165" id="L165" class="line" name="L165"> 3sto see
<3  href="Documentation/Co3iStyl3#L166"An8" cllmeasthe ases wh name="L25lslass="line" naloc"L246" clasord usan id="L101" class="line" name="L101"> 3vroSof
 3qramm.
nsmnts"L23ie="L103A hummis-ss="l3 59"> 16s3mple rknow sthe type sanyway 3ition)
rndkeepne" ck"lineod  S7  id=e 195"th34"> 129yd="L61 is much easier to write, and not the lea3ion();
maybe0crime="Ldrammers, C programmers do not use cute nam370
 24mc/awuot;struct fileinfo info;" is dec3single
 3onan/Codi3gStyle#L72" id="L72" cla3s="li3e"173"In p-lineme="L> 1separete '*&#hitesp" nameline of codeIses wh name="L25l id="L212" class="line" name="L212"> 3oalue 
ednat nnEXPORT*>macro f="L"> 120" name immed26" " na class="lss="lin id="L212" class="line" name="L212"> 3onhaou sh3href="Documentation/Codi3gStyl37L235" name="L2" nameof codeass="line" name="L113"> 113while, do).3his();
 3hat();
 168if (con3else {
 177}3etion)
        char *match_strdup(substring39}
 1380
        char *match_strdup(substring3Spaces
 382
 n/Cclased-castesp"LOCie"drred) -pluot;struct fileinfo info;" is dec3ly) on
2aaer t"L88">  88o"Le or aeruot;struct fileinfo info;" is dec3lis();
 3Linux,
 3 after
Do note""L61e" name="L1l id="L212" class="line" name="L212"> 3ared).
 389
 380
sof" nas="rnd y55"> 255/ases whun1This dojump"> 2e" na*&#ass="line" name="L234"> 234context3 while
 3 2
 24mcmultip91        if, switch, case, for, do3file);
mhes=ork"L228"> 2="9;nup"has al be Lolaass="line" name="L234"> 234context3 nhaou sh3href="Documentation/Codi3gStyl39L165" id="L165" class="line" name="L165"> 3ple is
 113while, do).3pinux,
 3pafter
This do innot aps="linvariabass="line""ne""" name id="L197" class="line" name="L197"> 3pred).
Gim id="L147" class="line" name="L147"> 499
anpdrr"L61l/a>vidu doote"ng pois"w1eammaklin id="L212" class="line" name="L212"> 4e, the
 492 the
 15"> 255ndan="L2docan s ;ass="line" name="L168"> 168if (con4nogram.
<4href="Documentation/Codi4gStyl4#L203" id="L203" class="line" name="L203"> 403
 168if (con4n5
 177}4tptr);
        char *match_strdup(substring4nrning.
<4href="Documentation/Codi4gStyl40L237" id="L236" clabud=e  = kmntsoc(SIZE/a>        char *match_strdup(substring407
 4ators,
 168if (con4these:
        char *match_strdup(substring410
 41d not
 174if (condi412
 174if (condi413
 155             4efined
 141ptr);
        char *match_strdup(substring41rning.
<4href="Documentation/Codi4gStyl41L237" id="L237" classgoentouta>        char *match_strdup(substring4a7
 141tors,
 155             4ators:
 113while, do).4a0
        char *match_strdup(substring421
        char *match_strdup(substring422
 1423
 4s with
 4nes as
 4stors:
sa dangne" naover-cid="L1linckth="L2 id="L238" class="line" name="L238"> 4up not
L11">  > 242bet/a>De> id="L101" class="line" name="L101"> 4esult,
 15"df p-cter tot; _morke="_op
_obviousclass="lL11">  11wastly,"tmp",can se ujst.about pny 4space.
 234context430
 4nd can
wan="9lid="L164t>
L" clWHAT 9line"L171,5/a>aHOWass="line" name="L234"> 234context432
, trds cla0" id id="L22lid="L164me="L1me" name="L2body:="ss="line" name="L234"> 234context433
 lex class="li(to be 1separete" namd="L15"> t>Do nich as if you leave a blank line.  As a 4lines.
that coAome srndgolback"iabhaline" 6 f="L20" clane"Yripne"  id= as if you leave a blank line.  As a 4les as
 t"L24;rlincly sr ( names are frowned upon, descriptive na43tors:
  g asgerylWHY"it"L171ames are frowned upon, descriptive na43sult,
 234context4dula-2
 4s like
  ass="line" name="L234"> 234context4dd can
 2183" c-doc-nano-HOWTO.tx>ysme="whiles2183" c-docss="line" name="L234"> 234context4d2
 444
 1C89"0">  4/*6"li */space aro44"uot;struct fileinfo info;" is dec4ses as
  4//6"li>sbeng tid="L16uot;struct fileinfo info;" is dec4stors:
 4fense.
 113while, do).4f8
 4eed to
 4e like
 126e""L201"s244" f="Lmultid="L1 id="L189" class="line" name="L189"> 4ed can
 234context4leries
 234context4ltand.
 4e4
 4l8
  1ls>simg rt 202" camd="L15drre,"w1eL102"" class="=as Ui) -pls="Lderivim id="L147" class="line" name="L147"> 4u have  4value 
 1umentation/Codi4gStyl46L155" id="L155" class="line" 9:"YriL11">vd=maL1me"mlasit; is aon-fpoduceive_ if ahere is onochang4sto see
<4  href="Documentation/Co4iStyl46L236" id="L236" class="line" name="L236"> 4vroSof
  OK,">  illodone"YriL11">vd=Aome srnd onamome="by 9long-simenelpef tecla name=GNU emac1ed in thuto>  8Unlrnd88">  26"> 1Clp-linease names are frowned upon, descriptive na4q8
vd=no 8UeerLOass=4020">aL171"dodter choose onedefaults is aon-fpoduceive_ if ahere is onochang4ion();
="ss="llasiescendesiraer t(t; 8act,"" class="wo05"sascenL120"  aon-fpoduceive_ if ahere is onochang4iuot;.
 - nn"inf=""tss="line" namonkeys"L226"> 54">nGNU emac1p"0cy st aon-fpoduceive_ if ahere is onochang4id can
 4oalue 
2arlu="L24d>
LOCLlatint,e="line" naick="L25" name6"> 54 9.emac1p ="L"line" name="L113"> 113while, do).4his();
 4hat();
 168if (con4else {
a end 1ed in ss="line" name="L168"> 168if (con4e8
 168if (con49}
 168if (con49uot;.
 168if (con49d can
 168if (con49nan/Codi4href="Documentation/Codi4gStyl483211" id=(* (man s2lps 1ass="line" name="L168"> 168if (con49alue 
 168if (con49nhaou sh4href="Documentation/Codi4gStyl48L235" id="L235" class="line" name="L235"> 4lis();
mhe-hook id="L235" class="line" name="L235"> 4lat();
 168if (con49lse {
 168if (con498
 168if (con489
 168if (con480
 168if (con48d can
 4 2
 4file);
 4fnhaou sh4href="Documentation/Codi4gStyl49L165" id="L165" class="line" name="L165"> 4ple is
 4pinux,
 168if (con4pafter
 4f8
o"Le apine"riete &="L> id="L212" class="line" name="L212"> 599
 591
 592 the
 5nogram.
<5href="Documentation/Codi5gStyl50L153" id="L153" class(setqsline" -tabs-modett) id="L212" class="line" name="L212"> 5n4gram.
<5href="Documentation/Codi5gStyl50L214" id="L2111111111(U-set-s244" 0">  4" (an-tabs-ne" ed in ))))) id="L212" class="line" name="L212"> 5n5
 5tptr);
Dtesp"LOCt183" clcame=""s244" f="LC id="L165" class="line" name="L165"> 5t7tr);

 5ators,
ay s=7< tcripfail 54 ged="L22emac1pal d>ssansd88">  ="L2,5/a> id="L238" class="line" name="L238"> 5these:
  4="line" name="L36">  36Heed that w510
 51d not
 51ogram.
<5href="Documentation/Codi5gStyl51L153"hasmeme="L242"why"="li(to be 1g mixitme" willimmne" ="L16ole on1uot;struct fileinfo info;" is dec513
  /a>atoolbaichoeca namy s=7 cla/id=rs" naGNU cnne" ot;struct fileinfo info;" is dec515
o42"matint),_p-c="lierstag mixinne" "ot;ss="line" name="L234"> 234context51rning.
<5href="Documentation/Codi5gStyl51L237"ole on1n toop
-kr -i8ed in t(line"> f="Led in K&R, 836" cac/a>Dinne" 1ed in ),e="L nass="line" name="L234"> 234context517
  4meme="L24nne" 14meat nnletestaso44"uot;struct fileinfo info;" is dec51tors,
 5ators:
  4"has 20"lty,&6ole on1 129 5a0
  ="L2c="limay>wan="t>
Lid=inglook r tot; mmispagane"Bu>9" id="L79" class="line" name="L79"> 5ad not
  4sts"linee" ix f="Lbai3lass="lmiipass="line" name="L234"> 234context522
 523
 5s with
 5nes as
 5stors:
  4sdef=""tis do global functions.  If you have a f5esult,
This dotw> id="L101" class="line" name="L101"> 5space.
 5s0
 5nd can
 5n2
  4Aune""L61supg rted in ss="line" name="L168"> 168if (con533
 e="NET id="L101" class="line" name="L101"> 5n with
 5nes as
sotesp"an8" cl id="L101" class="line" name="L101"> 5ntors:
 2SEs (anh(me="L2" name=sa>o42"e names are frowned upon, descriptive na53p not
ssystat-Unlrames are frowned upon, descriptive na53sult,
 234context5dula-2
 5s like
 id="L212" class="line" name="L212"> 5dd can
 5d2
 5stand.
 5s with
 e="EXPERIMENTAL && !ARCH_USES_SLAB_PAGE_STRUCT id="L101" class="line" name="L101"> 5ses as
  4SLUB (Unqueuei3Alloc";or)ed in ss="line" name="L168"> 168if (con5stors:
 155             5fense.
 5f8
 2le &q6supg rt f="Llerame= id="L236" class="line" name="L236"> 5eed to
 5e like
 5ed can
 5e2
  4ADFS2le &q6supg rt (DANGEROUS)ed in ss="line" name="L168"> 168if (con5ltand.
 e="ADFS_FSss="line" name="L168"> 168if (con5l with
 155             5nd can
 5ntors:
 5nense.
 21build/ke of c-s="line".tx>ine" name="L155"> 155             5n8
 5u have  5quot;.
 5qd can
 5ype of od="havsuvisgeili8"  ut="L1m onepe="le-onor aem id="L147" class="line" name="L147"> 5value 
 5v with
 1umentation/Codi5gStyl56L155"re=e 19nemL2uL16u="I= LOCt183" c, garbne" colle="L18oL171ame="L725"istm(ne" id="L147" class="line" name="L147"> 5vd can
 5vtors:

re=e 19nemL2uL1L2ll/9/a>=ine" name="L155"> 155             5qramm.
 5q8
        if, switch, case, for, do5ion();
rse" naive ncclas/a>
LOCLdrredround the3 5iuot;.
 5id can
 5ipe of  5oalue 
 5i with
so clkeepndrredround the 5id can
 186 5hat();
 5iramm.
 5e8
}
 103rse na id=e 195" toop
e"Doc 1ed in rd usalpube"DocmL2uL1LL2uL16 as if you leave a blank line.  As a 59uot;.
rs 129 59d can
lpube"DocmL2uL1Lgo1ls" czeron id="L212" class="line" name="L212"> 59nan/Codi5href="Documentation/Codi5gStyl58"173" id="L173" class="line" name="L173"> 59alue 
Do n=sss=k"Ld" naed in multid=y sl-re=e 19ne-L2uL1"L6>sbeng te" be 59 with
rse29 59d can
 59lse {
dname="L7 id="L157" class="line" name="L157"> 598
sl8 589
 580
 58d can
 58nan/Codi5href="Documentation/Codi5gStyl59"173" id="L173" class="line" name="L173"> 5file);
Do nmacrossdef=""L22licstaL164re" =absls"Do n id="L212" class="line" name="L212"> 58 with
 5ple is
 5pat();
 5pafter
 588
 699
macro nam">D2s="apind="nam"Lb5">macrosshe 691
 692 the
 6nogram.
<6href="Documentation/Codi6gStyl60L153"GenerGLrn, e=8="ee'*&#hi2s="26e""Laer t" cmacrosshe 694gram.
<6href="Documentation/Codi6gStyl60L244" id="L244" class="line" name="L244"> 6n5
 6tptr);
 6t7tr);
 6t8tr);
 6t9tr);
 6these:
 6t1
 61d not
 61ogram.
<6href="Documentation/Codi6gStyl61L193"T "L2actcla0" idw1eamus"L61macrost id="L101" class="line" name="L101"> 613
 615
od="nffd=am" narol famet id="L101" class="line" name="L101"> 61ptr);
 61rning.
<6href="Documentation/Codi6gStyl61L237"#def="eeFOO(x) id="L155" classsssssss classsssss\ id="L236" class="line" name="L236"> 6t8tr);
 61tors,
 6ators:
 6a1
 6ad not
 622
ote"s>3">l toop
ea c"L6ed in ss="line" name="L168"> 168if (con623
rse nath="es" oi"L231or a "> 15"dfn id="L212" class="line" name="L212"> 6s with
 6nes as
od="depee"L18oaiviiningloc"L246" clasotesp"acmagicion/Ct id="L101" class="line" name="L101"> 6stors:
 6up not
 6ators,
 6space.
  ame="Liinins5helldw1eam namor as"ot;ss="line" name="L234"> 234context6s0
  pr namto breakne"  24mcseemiiprn4menoce" "ay ma ln id="L212" class="line" name="L212"> 6nd can
 6n2
sons5l-a>2arl:eFOO(x) = y;i"L23 id="L182" class="line" name="L182"> 6n3
 id1" ibody e.g. lineseFOO 54">nnn"in8="ee'*&#n id="L212" class="line" name="L212"> 6n with
 6nes as
 6ntors:
 6np not
 n/Cclaln id="L212" class="line" name="L212"> 6ntors,
 6dula-2
 6d0
 6dd can
 6d2
 id="L182" class="line" name="L182"> 6d3
rseRTLeme="L242"/a>sof" nas="rndtesp"as 6s with
 6ses as
 6stors:
 6sp not
 6f8
rseammemal be sonamns5l &qrete. Do mi9lpp" c"L6 id="L238" class="line" name="L238"> 6eed to
ans=" wipplem id="L147" class="line" name="L147"> 6e like
>sbeng ="Led in dname="L70">  4stnstlaiu="Mamemot; mlasagas id="L236" class="line" name="L236"> 6ed can
 6e2
 6ltand.
btive al be &qrmi9a ei3tesp"atpefio n id="L212" class="line" name="L212"> 6l with
 6nd can
= (me=7;d) lda1"li a>2arL2me="" name="La0" io n id="L212" class="line" name="L212"> 6ntors:
 6nense.
 168if (con6n8
that co namo cmamemsthe3mlasagast3so clot; ryou cdy icess="line" name="L168"> 168if (con6u have  168if (con6u like
 168if (con6ud can
 t"L24;rcdy ice,a<l (an/183" cnh&gn Ldef="e  pr_debug()5a>  gr_info()n id="L212" class="line" name="L212"> 6ype of  6value 
  olne id="L212" class="line" name="L212"> 6v with
 1umentation/Codi6gStyl66L115"tive ahat,"" clate" be 6vd can
 ilem  ut w1eam3">lDEBUG symbolsts"linedef="ei3("od= id="L147" class="line" name="L147"> 6vtors:
 168if (con6uense.
  huto>  8Uu="Manylpubsystats"havs Ke of c"ole on1n cloine"on -DDEBUGn id="L212" class="line" name="L212"> 6y8
="VERBOSE_DEBUG ">nnddmdev_vdbg()5mlasagast" cot;ss="line" name="L234"> 234context6ion();
 6iuot;.
 6id can
 6ipe of  6ialue 
 6i with
 generGL purp="eamemory alloc";orst id="L101" class="line" name="L101"> 6id can
  vmalloc()u="P39;d "6e""Lo clot; API id="L101" class="line" name="L101"> 6itors:
  ne""eod  SLOCmn id="L212" class="line" name="L212"> 6iense.
 6e8
"f="LpDociiningso,  e" adround ni26"> 1" name6">t id="L101" class="line" name="L101"> 69}
 69uot;.
 168if (con69d can
 69nan/Codi6href="Documentation/Codi6gStyl68L193"T whalne"s tive"fo">"w=" 10round non/Cop
_pp" cem  ut hu t>Dor aaeili8" ne" id="L147" class="line" name="L147"> 69alue 
lpoinne"246" claso) -pop
_ay ma " id="L147" class="line" name="L147"> 69 with
 69d can
 6lat();
2arLme="L242"a 0" id oinne"2i>Dordunda95neTt;,e ov>rsis do global functions.  If you have a f69lse {
nnnya"L102d oinne"2" -pop
_guara95e ="by "> 1Cllass="lmiipdo global functions.  If you have a f698

 680
 68d can
 68nan/Codi6href="Documentation/Codi6gStyl69"173" id="L173" class="line" name="L173"> 6file);
mhenmispercele ont"od="gcc5has 20magicied in mamem/C id="L212" class="line" name="L212"> 68 with
 1 namt; inentastte" be id="L212" class="line" name="L212"> 68d can
 6pafter
lpystat>as 20who91sdown, dueo claabiggcl id="L101" class="line" name="L101"> 6p8
 1" otpriL1t/a>o"Le CPU129 799
o"Le pagacac> . Jrstad="Lk"eod  Sin th pagacac> nmisstte/a>="s id="L182" class="line" name="L182"> 791
 id="L212" class="line" name="L212"> 792 the
n"hea> 5nmilis9e odsn id="L212" class="line" name="L212"> 793 the
 794gram.
<7href="Documentation/Codi7gStyl70L244"Amreasonaer trulamt; ttumbni26"o /a>bp  Sin8="eer t'*&#hi>od="havsumore id="L212" class="line" name="L212"> 7n5
="w=" 1 id="L212" class="line" name="L212"> 7n6
 n/Cclani26knowne" nbe ilesime 7n7
*know*e oneli> ileri"L231be 7t8tr);
 7t9tr);
 7these:
 7t1
L61in8="ee" c'*&#hi>od="ar1s innici29 71d not
5lsts id="L212" class="line" name="L212"> 71ogram.
<7href="Documentation/Codi7gStyl71L193"oechniUnlrndliL20ct,"gcc5isttepder tt; inent"L61ot;sethuto>  8Unlrndtespoos id="L212" class="line" name="L212"> 714gram.
<7href="Documentation/Codi7gStyl71L244"help,5ne""ot; mminnenalne242suee naremov"L61ot; in8="eew1eama s9e odm/a>r id="L212" class="line" name="L212"> 715
lpots="""L246luamt; tt;,hi" "otr toells"gcc5al d> id="L212" class="line" name="L212"> 716
havsud namnnywayn id="L212" class="line" name="L212"> 7t7
 7t8tr);
 71tors,
2ar64re" nam"> id="L238" class="line" name="L238"> 7ators:
 7a1
2ar64o nmanyndid=e 195"k"Lds 129 7ad not
mhen42"a 06luam"Ldic";"L61w1e" cl onee'*&#"L22cto ed  names are frowned upon, descriptive na722
 723
 725
 7nes as
 7stors:
D narephe 7s8tr);
 1Cls="line"4mensuio  adrouoig6dis;"L9;*&# id="L236" class="line" name="L236"> 7stors,
ne oneli> ileri"0fi9s nmisLid=s id="L236" class="line" name="L236"> 7space.
 7s0
 7nd can
 7n2
 1on/Coe" ad'*&#"iase" a9;*&#"or an3imiqretive"limmne"  id="L101" class="line" name="L101"> 7n3
 1on/C id="L101" class="line" name="L101"> 7n5
 7nes as
 7ntors:
  4sts"a"limmne" 5ne""ot; ndd_work()"fname="L2r"lines 09" id="L79" class="line" name="L79"> 7np not
  4sts9" id="L79" class="line" name="L79"> 7ntors,
 idit"L22cto s/li id="L173" class="line" name="L173"> 7dula-2
 7d0
 7dd can
5lslicvs=""L1 129 7d2
 7d3
 7s with
 7ses as
2arLi26"> 1a9;ualmresult o nd=5"> u"line", ret cl id="L101" class="line" name="L101"> 7stors:
 u"line""L22cto ed,ass="linesubjd=ts"> id="L212" class="line" name="L212"> 7sp not
 7stors,
bec'*&#hi>od="r"line" oinne"s;to cla nass="line" name="L234"> 234context7eed to
o"Le ERR_PTR meay mism"t>
reg rt failtheuss="line" name="L234"> 234context7e0
 7ed can
 7e2
 7e3
 7l with
od= id="L244" class="line" name="L244"> 7les as
that co na, ret cl ascenexplicitrndlidntatso/Co46" cnt o n=semtcrilselfuss="line" name="L234"> 234context7etors:
 7nense.
 7ntors,
 7u have  7u like
 7ud can
 234context7ype of  7value 
 7u with
 1umentation/Codi7gStyl76L165" id="L165" class="line" name="L165"> 7vd can
  max()cmacross>od="docstre=ts" -pocheck"L2op tcri id="L165" class="line" name="L165"> 7vtors:
 7vense.
 7y8
 7ion();
 7iuot;.
 7id can
 7ipe of   ne""elinddei3  id="L182" class="line" name="L182"> 7ialue 
 7i with
 7id can
 7itors:
 7iense.
 7e8
 79}
 79uot;.
 79d can
 79pe of  ile-limmne":n toop
gcc5-DMAGIC_DEBUG_FLAG1" o.ced in ss="line" name="L168"> 168if (con79alue 
 168if (con79 with
 168if (con79d can
 7lat();
 79ense.
 798
 168if (con789
 780
amensuionnnya"f/3">s nn  P ...  tive ahaie" wns" rsona3 id="L182" class="line" name="L182"> 78d can
 78nan/Codi7href="Documentation/Codi7gStyl79"173"mensuios marklalcf="Lie""L1  ne""a>  mine"e of cur     n  P ...  mand namot;il id="L101" class="line" name="L101"> 7file);
omandtive so/Coet cl magici id=o1"fo"cmam>L61in""L1  ne" id="L101" class="line" name="L101"> 7f with
 78d can
 7pat();
 7pafter
 7p8
 899
 891
 1ClPass="lmiip L="line", S9e odmEdi;ne" id="L101" class="line" name="L101"> 892 the
 893 the
 894 the
 895 the
http://cm.bell-labs.lim/cm/cs/cbook/230" id="L230" class="line" name="L230"> 896 the
 8n7
 1Pra9;*nemoflPass="lmiip id="L236" class="line" name="L236"> 8n8
 899
 8these:
 8t1
http://cm.bell-labs.lim/cm/cs/tpop/236" id="L236" class="line" name="L236"> 81d not
 81ogram.
<8href="Documentation/Codi8gStyl81L193"GNU manu ds -s" ehe3 lialne2tesp"K&R1ne""oti26"ext -sfo"ccpp,"gcc  id="L182" class="line" name="L182"> 814gram.
<8href="Documentation/Codi8gStyl81L244"gcc5inne"s ds 29http://www.gnu.org/manu d/182" id="L182" class="line" name="L182"> 815 the
 816
 1inne"s ine""L2staLdardiz  ne""workiip groupo/a>o"Le pass="lmiip id="L236" class="line" name="L236"> 8t7
http://www.opee-std.org/JTC1/SC22/WG14/165" id="L165" class="line" name="L165"> 818
 81tors,
 8ators:
http://www.kroah.lim/l (an/talks/ols_2002_183" c_lidntas101"_talk/htmd/238" id="L238" class="line" name="L238"> 8a1
 8ad not
 822
 823
 825



T> 1origi""L2LXR softwnre 1id="L212"http://t-linef="ge.net/projd=ts/lxr">LXR limmuni8"165","oti26expefiss="ll v>rsis lxr@l (an.no165".
lxr.l (an.no"k"Ld86Redpill Linpro AS165","prov ioe" naL (an