Deleted Added
full compact
style.9 (71895) style.9 (71917)
1.\" Copyright (c) 1995 FreeBSD Inc.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
1.\" Copyright (c) 1995 FreeBSD Inc.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 8 unchanged lines hidden (view full) ---

17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD: head/share/man/man9/style.9 71895 2001-02-01 16:38:02Z ru $
25.\" $FreeBSD: head/share/man/man9/style.9 71917 2001-02-02 03:11:22Z nik $
26.\"
27.Dd December 14, 1995
28.Dt STYLE 9
29.Os FreeBSD
30.Sh NAME
31.Nm style
32.Nd "Kernel source file style guide"
33.Sh DESCRIPTION

--- 343 unchanged lines hidden (view full) ---

377.Bd -literal
378static char *
379function(int a1, int a2, float fl, int a4)
380{
381.Ed
382.Pp
383When declaring variables in functions declare them sorted by size,
384then in alphabetical order; multiple ones per line are okay.
26.\"
27.Dd December 14, 1995
28.Dt STYLE 9
29.Os FreeBSD
30.Sh NAME
31.Nm style
32.Nd "Kernel source file style guide"
33.Sh DESCRIPTION

--- 343 unchanged lines hidden (view full) ---

377.Bd -literal
378static char *
379function(int a1, int a2, float fl, int a4)
380{
381.Ed
382.Pp
383When declaring variables in functions declare them sorted by size,
384then in alphabetical order; multiple ones per line are okay.
385Declaring functions inside functions is not recommended, since their
386linkage scope is always global. If a line overflows reuse the type
387keyword.
385If a line overflows reuse the type keyword.
388.Pp
389Be careful to not obfuscate the code by initializing variables in
390the declarations. Use this feature only thoughtfully.
391DO NOT use function calls in initializers!
392.Bd -literal
393 struct foo one, *two;
394 double three;
395 int *four, five;

--- 170 unchanged lines hidden ---
386.Pp
387Be careful to not obfuscate the code by initializing variables in
388the declarations. Use this feature only thoughtfully.
389DO NOT use function calls in initializers!
390.Bd -literal
391 struct foo one, *two;
392 double three;
393 int *four, five;

--- 170 unchanged lines hidden ---