style.9 (130432) | style.9 (130582) |
---|---|
1.\" Copyright (c) 1995-2001 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. --- 29 unchanged lines hidden (view full) --- 38Be careful to check the examples before assuming that 39.Nm 40is silent on an issue. 41.Bd -literal 42/* 43 * Style guide for FreeBSD. Based on the CSRG's KNF (Kernel Normal Form). 44 * 45 * @(#)style 1.14 (Berkeley) 4/28/95 | 1.\" Copyright (c) 1995-2001 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. --- 29 unchanged lines hidden (view full) --- 38Be careful to check the examples before assuming that 39.Nm 40is silent on an issue. 41.Bd -literal 42/* 43 * Style guide for FreeBSD. Based on the CSRG's KNF (Kernel Normal Form). 44 * 45 * @(#)style 1.14 (Berkeley) 4/28/95 |
46 * $FreeBSD: head/share/man/man9/style.9 130432 2004-06-13 21:24:56Z le $ | 46 * $FreeBSD: head/share/man/man9/style.9 130582 2004-06-16 08:33:57Z ru $ |
47 */ 48 49/* 50 * VERY important single-line comments look like this. 51 */ 52 53/* Most single-line comments look like this. */ 54 --- 26 unchanged lines hidden (view full) --- 81.Bd -literal 82#if 0 83#ifndef lint 84static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; 85#endif /* not lint */ 86#endif 87 88#include <sys/cdefs.h> | 47 */ 48 49/* 50 * VERY important single-line comments look like this. 51 */ 52 53/* Most single-line comments look like this. */ 54 --- 26 unchanged lines hidden (view full) --- 81.Bd -literal 82#if 0 83#ifndef lint 84static char sccsid[] = "@(#)style 1.14 (Berkeley) 4/28/95"; 85#endif /* not lint */ 86#endif 87 88#include <sys/cdefs.h> |
89__FBSDID("$FreeBSD: head/share/man/man9/style.9 130432 2004-06-13 21:24:56Z le $"); | 89__FBSDID("$FreeBSD: head/share/man/man9/style.9 130582 2004-06-16 08:33:57Z ru $"); |
90.Ed 91.Pp 92Leave another blank line before the header files. 93.Pp 94Kernel include files (i.e.\& 95.Pa sys/*.h ) 96come first; normally, include 97.In sys/types.h --- 17 unchanged lines hidden (view full) --- 115#include <protocols/rwhod.h> 116.Ed 117.Pp 118Do not use files in 119.Pa /usr/include 120for files in the kernel. 121.Pp 122Leave a blank line before the next group, the | 90.Ed 91.Pp 92Leave another blank line before the header files. 93.Pp 94Kernel include files (i.e.\& 95.Pa sys/*.h ) 96come first; normally, include 97.In sys/types.h --- 17 unchanged lines hidden (view full) --- 115#include <protocols/rwhod.h> 116.Ed 117.Pp 118Do not use files in 119.Pa /usr/include 120for files in the kernel. 121.Pp 122Leave a blank line before the next group, the |
123.Pa /usr/include | 123.Pa /usr/include |
124files, 125which should be sorted alphabetically by name. 126.Bd -literal 127#include <stdio.h> 128.Ed 129.Pp 130Global pathnames are defined in 131.In paths.h . --- 110 unchanged lines hidden (view full) --- 242 243#ifndef COMPAT_43 244/* Yet another large region here, or other conditional code. */ 245#else /* COMPAT_43 */ 246/* Or here. */ 247#endif /* !COMPAT_43 */ 248.Ed 249.Pp | 124files, 125which should be sorted alphabetically by name. 126.Bd -literal 127#include <stdio.h> 128.Ed 129.Pp 130Global pathnames are defined in 131.In paths.h . --- 110 unchanged lines hidden (view full) --- 242 243#ifndef COMPAT_43 244/* Yet another large region here, or other conditional code. */ 245#else /* COMPAT_43 */ 246/* Or here. */ 247#endif /* !COMPAT_43 */ 248.Ed 249.Pp |
250The project is slowly moving to use the 251.St -isoC-99 | 250The project is slowly moving to use the 251.St -isoC-99 |
252unsigned integer identifiers of the form | 252unsigned integer identifiers of the form |
253.Ic uintXX_t 254in preference to the older BSD-style integer identifiers of the form 255.Ic u_intXX_t . | 253.Vt uintXX_t 254in preference to the older 255.Bx Ns -style 256integer identifiers of the form 257.Vt u_intXX_t . |
256New code should use the former, and old code should be converted to 257the new form if other major work is being done in that area and | 258New code should use the former, and old code should be converted to 259the new form if other major work is being done in that area and |
258there's no overriding reason to prefer the older BSD-style. | 260there is no overriding reason to prefer the older 261.Bx Ns -style . |
259Like white-space commits, care should be taken in making | 262Like white-space commits, care should be taken in making |
260.Ic uintXX_t | 263.Vt uintXX_t |
261only commits. 262.Pp 263Enumeration values are all uppercase. 264.Bd -literal 265enum enumtype { ONE, TWO } et; 266.Ed 267.Pp 268In declarations, do not put any whitespace between asterisks and --- 555 unchanged lines hidden --- | 264only commits. 265.Pp 266Enumeration values are all uppercase. 267.Bd -literal 268enum enumtype { ONE, TWO } et; 269.Ed 270.Pp 271In declarations, do not put any whitespace between asterisks and --- 555 unchanged lines hidden --- |