style.9 (15082) | style.9 (15095) |
---|---|
1.Dd December 14, 1995 2.Dt STYLE 9 3.Os FreeBSD 2.2 4.Sh NAME 5.Nm style 6.Nd "Kernel source file style guide" 7.Sh DESCRIPTION 8This file contains an example of the preferred style for kernel source --- 192 unchanged lines hidden (view full) --- 201 stmt1; 202 stmt2; 203 } 204.Ed 205.Pp 206Second level indents are four spaces. 207.Bd -literal -offset 0i 208 while (cnt < 20) | 1.Dd December 14, 1995 2.Dt STYLE 9 3.Os FreeBSD 2.2 4.Sh NAME 5.Nm style 6.Nd "Kernel source file style guide" 7.Sh DESCRIPTION 8This file contains an example of the preferred style for kernel source --- 192 unchanged lines hidden (view full) --- 201 stmt1; 202 stmt2; 203 } 204.Ed 205.Pp 206Second level indents are four spaces. 207.Bd -literal -offset 0i 208 while (cnt < 20) |
209 z = a + really + long + statment + that + needs + | 209 z = a + really + long + statement + that + needs + |
210 two lines + gets + indented + four + spaces + 211 on + the + second + and + subsequent + lines. 212.Ed 213.Pp 214Closing and opening braces go on the same line as the else. 215Don't add braces that aren't necessary. 216.Bd -literal -offset 0i 217 if (test) --- 26 unchanged lines hidden (view full) --- 244 exit(EX_OK); /* 245 * Avoid obvious comments such as 246 * "Exit 0 on success." 247 */ 248} 249.Ed 250.Pp 251The function type should be on a line by itself | 210 two lines + gets + indented + four + spaces + 211 on + the + second + and + subsequent + lines. 212.Ed 213.Pp 214Closing and opening braces go on the same line as the else. 215Don't add braces that aren't necessary. 216.Bd -literal -offset 0i 217 if (test) --- 26 unchanged lines hidden (view full) --- 244 exit(EX_OK); /* 245 * Avoid obvious comments such as 246 * "Exit 0 on success." 247 */ 248} 249.Ed 250.Pp 251The function type should be on a line by itself |
252preceeding the function. | 252preceding the function. |
253.Bd -literal -offset 0i 254static char * 255function(a1, a2, fl, a4) 256 int a1, a2, a4; /* Declare ints, too, don't default them. */ 257 float fl; /* List in order declared, as much as possible. */ 258{ 259.Ed 260.Pp --- 148 unchanged lines hidden --- | 253.Bd -literal -offset 0i 254static char * 255function(a1, a2, fl, a4) 256 int a1, a2, a4; /* Declare ints, too, don't default them. */ 257 float fl; /* List in order declared, as much as possible. */ 258{ 259.Ed 260.Pp --- 148 unchanged lines hidden --- |