xref: /freebsd/share/man/man9/style.9 (revision bcce9a2b33a8e9187a63f435726a7a801e89f326)
1.\"-
2.\" Copyright (c) 1995-2005 The FreeBSD Project
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL [your name] OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\"	From: @(#)style	1.14 (Berkeley) 4/28/95
27.\" $FreeBSD$
28.\"
29.Dd January 25, 2018
30.Dt STYLE 9
31.Os
32.Sh NAME
33.Nm style
34.Nd "kernel source file style guide"
35.Sh DESCRIPTION
36This file specifies the preferred style for kernel source files in the
37.Fx
38source tree.
39It is also a guide for the preferred userland code style.
40Many of the style rules are implicit in the examples.
41Be careful to check the examples before assuming that
42.Nm
43is silent on an issue.
44.Bd -literal
45/*
46 * Style guide for FreeBSD.  Based on the CSRG's KNF (Kernel Normal Form).
47 *
48 *	@(#)style	1.14 (Berkeley) 4/28/95
49 * $FreeBSD$
50 */
51
52/*
53 * VERY important single-line comments look like this.
54 */
55
56/* Most single-line comments look like this. */
57
58/*
59 * Multi-line comments look like this.  Make them real sentences.  Fill
60 * them so they look like real paragraphs.
61 */
62.Ed
63.Pp
64The copyright header should be a multi-line comment, with the first
65line of the comment having a dash after the star like so:
66.Bd -literal
67/*-
68 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
69 *
70 * Copyright (c) 1984-2025 John Q. Public
71 * All rights reserved.
72 *
73 * Long, boring license goes here, but trimmed for brevity
74 */
75.Ed
76.Pp
77An automatic script collects license information from the tree for
78all comments that start in the first column with
79.Dq Li "/*-" .
80If you desire to flag
81.Xr indent 1
82to not reformat a comment that starts in the first column which is not a
83license or copyright notice, change the dash to a star for those
84comments.
85Comments starting in columns other than the first are never
86considered license statements.
87Use the appropriate SPDX-License-Identifier line before the copyright.
88.Pp
89After any copyright header, there is a blank line, and the
90.Li $\&FreeBSD$
91for non C/C++ language source files.
92Version control system ID tags should only exist once in a file
93(unlike in this one).
94Non-C/C++ source files follow the example above, while C/C++ source files
95follow the one below.
96All VCS (version control system) revision identification in files obtained
97from elsewhere should be maintained, including, where applicable, multiple IDs
98showing a file's history.
99In general, do not edit foreign IDs or their infrastructure.
100Unless otherwise wrapped (such as
101.Dq Li "#if defined(LIBC_SCCS)" ) ,
102enclose both in
103.Dq Li "#if 0 ... #endif"
104to hide any uncompilable bits
105and to keep the IDs out of object files.
106Only add
107.Dq Li "From: "
108in front of foreign VCS IDs if the file is renamed.
109.Bd -literal
110/* From: @(#)style	1.14 (Berkeley) 4/28/95 */
111
112#include <sys/cdefs.h>
113__FBSDID("$FreeBSD$");
114.Ed
115.Pp
116Leave one blank line before the header files.
117.Pp
118Kernel include files
119.Pa ( sys/*.h )
120come first.
121If
122.In sys/cdefs.h
123is needed for
124.Fn __FBSDID ,
125include it first.
126If either
127.In sys/types.h
128or
129.In sys/param.h
130is needed, include it before other include files.
131.Po
132.In sys/param.h
133includes
134.In sys/types.h ;
135do not include both.
136.Pc
137The remaining kernel headers should be sorted alphabetically.
138.Bd -literal
139#include <sys/types.h>	/* Non-local includes in angle brackets. */
140#include <sys/endian.h>
141#include <sys/lock.h>
142#include <sys/queue.h>
143.Ed
144.Pp
145For a network program, put the network include files next.
146.Bd -literal
147#include <net/if.h>
148#include <net/if_dl.h>
149#include <net/route.h>
150#include <netinet/in.h>
151#include <protocols/rwhod.h>
152.Ed
153.Pp
154Do not include files from
155.Pa /usr/include
156in the kernel.
157.Pp
158Leave a blank line before the next group, the
159.Pa /usr/include
160files,
161which should be sorted alphabetically by name.
162.Bd -literal
163#include <stdio.h>
164.Ed
165.Pp
166Global pathnames are defined in
167.In paths.h .
168Pathnames local
169to the program go in
170.Qq Pa pathnames.h
171in the local directory.
172.Bd -literal
173#include <paths.h>
174.Ed
175.Pp
176Leave another blank line before the local include files.
177.Bd -literal
178#include "pathnames.h"		/* Local includes in double quotes. */
179.Ed
180.Pp
181Do not
182.Ic #define
183or declare names in the implementation namespace except
184for implementing application interfaces.
185.Pp
186The names of
187.Dq unsafe
188macros (ones that have side effects), and the names of macros for
189manifest constants, are all in uppercase.
190The expansions of expression-like macros are either a single token
191or have outer parentheses.
192Put a single tab character between the
193.Ic #define
194and the macro name.
195If a macro is an inline expansion of a function, the function name is
196all in lowercase and the macro has the same name all in uppercase.
197.\" XXX the above conflicts with ANSI style where the names are the
198.\" same and you #undef the macro (if any) to get the function.
199.\" It is not followed for MALLOC(), and not very common if inline
200.\" functions are used.
201Right-justify the
202backslashes; it makes it easier to read.
203If the macro encapsulates a compound statement, enclose it in a
204.Ic do
205loop,
206so that it can safely be used in
207.Ic if
208statements.
209Any final statement-terminating semicolon should be
210supplied by the macro invocation rather than the macro, to make parsing easier
211for pretty-printers and editors.
212.Bd -literal
213#define	MACRO(x, y) do {						\e
214	variable = (x) + (y);						\e
215	(y) += 2;							\e
216} while (0)
217.Ed
218.Pp
219When code is conditionally compiled using
220.Ic #ifdef
221or
222.Ic #if ,
223a comment may be added following the matching
224.Ic #endif
225or
226.Ic #else
227to permit the reader to easily discern where conditionally compiled code
228regions end.
229This comment should be used only for (subjectively) long regions, regions
230greater than 20 lines, or where a series of nested
231.Ic #ifdef 's
232may be confusing to the reader.
233The comment should be separated from the
234.Ic #endif
235or
236.Ic #else
237by a single space.
238For short conditionally compiled regions, a closing comment should not be
239used.
240.Pp
241The comment for
242.Ic #endif
243should match the expression used in the corresponding
244.Ic #if
245or
246.Ic #ifdef .
247The comment for
248.Ic #else
249and
250.Ic #elif
251should match the inverse of the expression(s) used in the preceding
252.Ic #if
253and/or
254.Ic #elif
255statements.
256In the comments, the subexpression
257.Dq Li defined(FOO)
258is abbreviated as
259.Dq Li FOO .
260For the purposes of comments,
261.Dq Ic #ifndef Li FOO
262is treated as
263.Dq Ic #if Li !defined(FOO) .
264.Bd -literal
265#ifdef KTRACE
266#include <sys/ktrace.h>
267#endif
268
269#ifdef COMPAT_43
270/* A large region here, or other conditional code. */
271#else /* !COMPAT_43 */
272/* Or here. */
273#endif /* COMPAT_43 */
274
275#ifndef COMPAT_43
276/* Yet another large region here, or other conditional code. */
277#else /* COMPAT_43 */
278/* Or here. */
279#endif /* !COMPAT_43 */
280.Ed
281.Pp
282The project is slowly moving to use the
283.St -isoC-99
284unsigned integer identifiers of the form
285.Vt uintXX_t
286in preference to the older
287.Bx Ns -style
288integer identifiers of the form
289.Vt u_intXX_t .
290New code should use the former, and old code should be converted to
291the new form if other major work is being done in that area and
292there is no overriding reason to prefer the older
293.Bx Ns -style .
294Like white-space commits, care should be taken in making
295.Vt uintXX_t
296only commits.
297.Pp
298Similarly, the project is slowly moving to use the
299.St -isoC-99
300.Vt bool
301in preference to the older
302.Vt int
303or
304.Vt boolean_t .
305New code should use
306.Vt bool ,
307and old code may be converted if it is
308reasonable to do so.
309Literal values are named
310.Dv true
311and
312.Dv false .
313These are preferred to the old spellings
314.Dv TRUE
315and
316.Dv FALSE .
317Userspace code should include
318.In stdbool.h ,
319while kernel code should include
320.In sys/types.h .
321.Pp
322Likewise, the project is moving to using the
323.St -isoC-99
324designated initializers when it makes sense to do so.
325.Pp
326Enumeration values are all uppercase.
327.Bd -literal
328enum enumtype { ONE, TWO } et;
329.Ed
330.Pp
331The use of internal_underscores in identifiers is preferred over
332camelCase or TitleCase.
333.Pp
334In declarations, do not put any whitespace between asterisks and
335adjacent tokens, except for tokens that are identifiers related to
336types.
337(These identifiers are the names of basic types, type
338qualifiers, and
339.Ic typedef Ns -names
340other than the one being declared.)
341Separate these identifiers from asterisks using a single space.
342.Pp
343When declaring variables in structures, declare them sorted by use, then
344by size (largest to smallest), and then in alphabetical order.
345The first category normally does not apply, but there are exceptions.
346Each one gets its own line.
347Try to make the structure
348readable by aligning the member names using either one or two tabs
349depending upon your judgment.
350You should use one tab only if it suffices to align at least 90% of
351the member names.
352Names following extremely long types
353should be separated by a single space.
354.Pp
355Major structures should be declared at the top of the file in which they
356are used, or in separate header files if they are used in multiple
357source files.
358Use of the structures should be by separate declarations
359and should be
360.Ic extern
361if they are declared in a header file.
362.Bd -literal
363struct foo {
364	struct foo	*next;		/* List of active foo. */
365	struct mumble	amumble;	/* Comment for mumble. */
366	int		bar;		/* Try to align the comments. */
367	struct verylongtypename *baz;	/* Does not fit in 2 tabs. */
368};
369struct foo *foohead;			/* Head of global foo list. */
370.Ed
371.Pp
372Use
373.Xr queue 3
374macros rather than rolling your own lists, whenever possible.
375Thus,
376the previous example would be better written:
377.Bd -literal
378#include <sys/queue.h>
379
380struct foo {
381	LIST_ENTRY(foo)	link;		/* Use queue macros for foo lists. */
382	struct mumble	amumble;	/* Comment for mumble. */
383	int		bar;		/* Try to align the comments. */
384	struct verylongtypename *baz;	/* Does not fit in 2 tabs. */
385};
386LIST_HEAD(, foo) foohead;		/* Head of global foo list. */
387.Ed
388.Pp
389Avoid using typedefs for structure types.
390Typedefs are problematic because they do not properly hide their
391underlying type; for example you need to know if the typedef is
392the structure itself or a pointer to the structure.
393In addition they must be declared exactly once, whereas an
394incomplete structure type can be mentioned as many times as
395necessary.
396Typedefs are difficult to use in stand-alone header files:
397the header that defines the typedef must be included
398before the header that uses it, or by the header that uses
399it (which causes namespace pollution), or there must be a
400back-door mechanism for obtaining the typedef.
401.Pp
402When convention requires a
403.Ic typedef ,
404make its name match the struct tag.
405Avoid typedefs ending in
406.Dq Li _t ,
407except as specified in Standard C or by
408.Tn POSIX .
409.Bd -literal
410/* Make the structure name match the typedef. */
411typedef	struct bar {
412	int	level;
413} BAR;
414typedef	int		foo;		/* This is foo. */
415typedef	const long	baz;		/* This is baz. */
416.Ed
417.Pp
418All functions are prototyped somewhere.
419.Pp
420Function prototypes for private functions (i.e., functions not used
421elsewhere) go at the top of the first source module.
422Functions
423local to one source module should be declared
424.Ic static .
425.Pp
426Functions used from other parts of the kernel are prototyped in the
427relevant include file.
428Function prototypes should be listed in a logical order, preferably
429alphabetical unless there is a compelling reason to use a different
430ordering.
431.Pp
432Functions that are used locally in more than one module go into a
433separate header file, e.g.,
434.Qq Pa extern.h .
435.Pp
436Do not use the
437.Dv __P
438macro.
439.Pp
440In general code can be considered
441.Dq "new code"
442when it makes up about 50% or more of the file(s) involved.
443This is enough
444to break precedents in the existing code and use the current
445.Nm
446guidelines.
447.Pp
448The kernel has a name associated with parameter types, e.g., in the kernel
449use:
450.Bd -literal
451void	function(int fd);
452.Ed
453.Pp
454In header files visible to userland applications, prototypes that are
455visible must use either
456.Dq protected
457names (ones beginning with an underscore)
458or no names with the types.
459It is preferable to use protected names.
460E.g., use:
461.Bd -literal
462void	function(int);
463.Ed
464.Pp
465or:
466.Bd -literal
467void	function(int _fd);
468.Ed
469.Pp
470Prototypes may have an extra space after a tab to enable function names
471to line up:
472.Bd -literal
473static char	*function(int _arg, const char *_arg2, struct foo *_arg3,
474		    struct bar *_arg4);
475static void	 usage(void);
476
477/*
478 * All major routines should have a comment briefly describing what
479 * they do.  The comment before the "main" routine should describe
480 * what the program does.
481 */
482int
483main(int argc, char *argv[])
484{
485	char *ep;
486	long num;
487	int ch;
488.Ed
489.Pp
490For consistency,
491.Xr getopt 3
492should be used to parse options.
493Options
494should be sorted in the
495.Xr getopt 3
496call and the
497.Ic switch
498statement, unless
499parts of the
500.Ic switch
501cascade.
502Elements in a
503.Ic switch
504statement that cascade should have a
505.Li FALLTHROUGH
506comment.
507Numerical arguments should be checked for accuracy.
508Code which is unreachable for non-obvious reasons may be marked /*
509.Li NOTREACHED
510*/.
511.Bd -literal
512	while ((ch = getopt(argc, argv, "abNn:")) != -1)
513		switch (ch) {		/* Indent the switch. */
514		case 'a':		/* Do not indent the case. */
515			aflag = 1;	/* Indent case body one tab. */
516			/* FALLTHROUGH */
517		case 'b':
518			bflag = 1;
519			break;
520		case 'N':
521			Nflag = 1;
522			break;
523		case 'n':
524			num = strtol(optarg, &ep, 10);
525			if (num <= 0 || *ep != '\e0') {
526				warnx("illegal number, -n argument -- %s",
527				    optarg);
528				usage();
529			}
530			break;
531		case '?':
532		default:
533			usage();
534		}
535	argc -= optind;
536	argv += optind;
537.Ed
538.Pp
539Space after keywords
540.Pq Ic if , while , for , return , switch .
541Two styles of braces
542.Ql ( \&{
543and
544.Ql \&} )
545are allowed for single line statements.
546Either they are used for all single statements, or
547they are used only where needed for clarity.
548Usage within a function should be consistent.
549Forever loops are done with
550.Ic for Ns 's ,
551not
552.Ic while Ns 's .
553.Bd -literal
554	for (p = buf; *p != '\e0'; ++p)
555		;	/* nothing */
556	for (;;)
557		stmt;
558	for (;;) {
559		z = a + really + long + statement + that + needs +
560		    two + lines + gets + indented + four + spaces +
561		    on + the + second + and + subsequent + lines;
562	}
563	for (;;) {
564		if (cond)
565			stmt;
566	}
567	if (val != NULL)
568		val = realloc(val, newsize);
569.Ed
570.Pp
571Parts of a
572.Ic for
573loop may be left empty.
574Do not put declarations
575inside blocks unless the routine is unusually complicated.
576.Bd -literal
577	for (; cnt < 15; cnt++) {
578		stmt1;
579		stmt2;
580	}
581.Ed
582.Pp
583Indentation is an 8 character tab.
584Second level indents are four spaces.
585If you have to wrap a long statement, put the operator at the end of the
586line.
587.Bd -literal
588	while (cnt < 20 && this_variable_name_is_too_long &&
589	    ep != NULL)
590		z = a + really + long + statement + that + needs +
591		    two + lines + gets + indented + four + spaces +
592		    on + the + second + and + subsequent + lines;
593.Ed
594.Pp
595Do not add whitespace at the end of a line, and only use tabs
596followed by spaces
597to form the indentation.
598Do not use more spaces than a tab will produce
599and do not use spaces in front of tabs.
600.Pp
601Closing and opening braces go on the same line as the
602.Ic else .
603Braces that are not necessary may be left out.
604.Bd -literal
605	if (test)
606		stmt;
607	else if (bar) {
608		stmt;
609		stmt;
610	} else
611		stmt;
612.Ed
613.Pp
614No spaces after function names.
615Commas have a space after them.
616No spaces
617after
618.Ql \&(
619or
620.Ql \&[
621or preceding
622.Ql \&]
623or
624.Ql \&)
625characters.
626.Bd -literal
627	error = function(a1, a2);
628	if (error != 0)
629		exit(error);
630.Ed
631.Pp
632Unary operators do not require spaces, binary operators do.
633Do not use parentheses unless they are required for precedence or unless the
634statement is confusing without them.
635Remember that other people may
636confuse easier than you.
637Do YOU understand the following?
638.Bd -literal
639	a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1;
640	k = !(l & FLAGS);
641.Ed
642.Pp
643Exits should be 0 on success, or 1 on failure.
644.Bd -literal
645	exit(0);	/*
646			 * Avoid obvious comments such as
647			 * "Exit 0 on success."
648			 */
649}
650.Ed
651.Pp
652The function type should be on a line by itself
653preceding the function.
654The opening brace of the function body should be
655on a line by itself.
656.Bd -literal
657static char *
658function(int a1, int a2, float fl, int a4)
659{
660.Ed
661.Pp
662When declaring variables in functions declare them sorted by size,
663then in alphabetical order; multiple ones per line are okay.
664If a line overflows reuse the type keyword.
665.Pp
666Be careful to not obfuscate the code by initializing variables in
667the declarations.
668Use this feature only thoughtfully.
669DO NOT use function calls in initializers.
670.Bd -literal
671	struct foo one, *two;
672	double three;
673	int *four, five;
674	char *six, seven, eight, nine, ten, eleven, twelve;
675
676	four = myfunction();
677.Ed
678.Pp
679Do not declare functions inside other functions; ANSI C says that
680such declarations have file scope regardless of the nesting of the
681declaration.
682Hiding file declarations in what appears to be a local
683scope is undesirable and will elicit complaints from a good compiler.
684.Pp
685Casts and
686.Ic sizeof Ns 's
687are not followed by a space.
688Note that
689.Xr indent 1
690does not understand this rule.
691.Ic sizeof Ns 's
692are written with parenthesis always.
693The redundant parenthesis rules do not apply to
694.Fn sizeof var
695instances.
696.Pp
697.Dv NULL
698is the preferred null pointer constant.
699Use
700.Dv NULL
701instead of
702.Vt ( "type *" ) Ns 0
703or
704.Vt ( "type *" ) Ns Dv NULL
705in contexts where the compiler knows the
706type, e.g., in assignments.
707Use
708.Vt ( "type *" ) Ns Dv NULL
709in other contexts,
710in particular for all function args.
711(Casting is essential for
712variadic args and is necessary for other args if the function prototype
713might not be in scope.)
714Test pointers against
715.Dv NULL ,
716e.g., use:
717.Bd -literal
718(p = f()) == NULL
719.Ed
720.Pp
721not:
722.Bd -literal
723!(p = f())
724.Ed
725.Pp
726Do not use
727.Ic \&!
728for tests unless it is a boolean, e.g., use:
729.Bd -literal
730if (*p == '\e0')
731.Ed
732.Pp
733not:
734.Bd -literal
735if (!*p)
736.Ed
737.Pp
738Routines returning
739.Vt "void *"
740should not have their return values cast
741to any pointer type.
742.Pp
743Values in
744.Ic return
745statements should be enclosed in parentheses.
746.Pp
747Use
748.Xr err 3
749or
750.Xr warn 3 ,
751do not roll your own.
752.Bd -literal
753	if ((four = malloc(sizeof(struct foo))) == NULL)
754		err(1, (char *)NULL);
755	if ((six = (int *)overflow()) == NULL)
756		errx(1, "number overflowed");
757	return (eight);
758}
759.Ed
760.Pp
761When converting K&R style declarations to ANSI style, preserve
762any comments about parameters.
763.Pp
764Long parameter lists are wrapped with a normal four space indent.
765.Pp
766Variable numbers of arguments should look like this:
767.Bd -literal
768#include <stdarg.h>
769
770void
771vaf(const char *fmt, ...)
772{
773	va_list ap;
774
775	va_start(ap, fmt);
776	STUFF;
777	va_end(ap);
778	/* No return needed for void functions. */
779}
780
781static void
782usage()
783{
784	/* Insert an empty line if the function has no local variables. */
785.Ed
786.Pp
787Use
788.Xr printf 3 ,
789not
790.Xr fputs 3 ,
791.Xr puts 3 ,
792.Xr putchar 3 ,
793whatever; it is faster and usually cleaner, not
794to mention avoiding stupid bugs.
795.Pp
796Usage statements should look like the manual pages
797.Sx SYNOPSIS .
798The usage statement should be structured in the following order:
799.Bl -enum
800.It
801Options without operands come first,
802in alphabetical order,
803inside a single set of brackets
804.Ql ( \&[
805and
806.Ql \&] ) .
807.It
808Options with operands come next,
809also in alphabetical order,
810with each option and its argument inside its own pair of brackets.
811.It
812Required arguments
813(if any)
814are next,
815listed in the order they should be specified on the command line.
816.It
817Finally,
818any optional arguments should be listed,
819listed in the order they should be specified,
820and all inside brackets.
821.El
822.Pp
823A bar
824.Pq Ql \&|
825separates
826.Dq either-or
827options/arguments,
828and multiple options/arguments which are specified together are
829placed in a single set of brackets.
830.Bd -literal -offset 4n
831"usage: f [-aDde] [-b b_arg] [-m m_arg] req1 req2 [opt1 [opt2]]\en"
832"usage: f [-a | -b] [-c [-dEe] [-n number]]\en"
833.Ed
834.Bd -literal
835	(void)fprintf(stderr, "usage: f [-ab]\en");
836	exit(1);
837}
838.Ed
839.Pp
840Note that the manual page options description should list the options in
841pure alphabetical order.
842That is, without regard to whether an option takes arguments or not.
843The alphabetical ordering should take into account the case ordering
844shown above.
845.Pp
846New core kernel code should be reasonably compliant with the
847.Nm
848guides.
849The guidelines for third-party maintained modules and device drivers are more
850relaxed but at a minimum should be internally consistent with their style.
851.Pp
852Stylistic changes (including whitespace changes) are hard on the source
853repository and are to be avoided without good reason.
854Code that is approximately
855.Fx
856KNF
857.Nm
858compliant in the repository must not diverge from compliance.
859.Pp
860Whenever possible, code should be run through a code checker
861(e.g., various static analyzers or
862.Nm cc Fl Wall )
863and produce minimal warnings.
864.Sh SEE ALSO
865.Xr indent 1 ,
866.Xr err 3 ,
867.Xr warn 3 ,
868.Xr style.Makefile 5
869.Sh HISTORY
870This manual page is largely based on the
871.Pa src/admin/style/style
872file from the
873.Bx 4.4 Lite2
874release, with occasional updates to reflect the current practice and
875desire of the
876.Fx
877project.
878.Pa src/admin/style/style
879is a codification by the CSRG of the programming style of Ken Thompson and
880Dennis Ritchie in
881.At v6 .
882