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