Changeset View
Changeset View
Standalone View
Standalone View
head/share/man/man9/style.9
Show All 20 Lines | |||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" From: @(#)style 1.14 (Berkeley) 4/28/95 | .\" From: @(#)style 1.14 (Berkeley) 4/28/95 | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd November 22, 2015 | .Dd December 5, 2015 | ||||
.Dt STYLE 9 | .Dt STYLE 9 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm style | .Nm style | ||||
.Nd "kernel source file style guide" | .Nd "kernel source file style guide" | ||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
This file specifies the preferred style for kernel source files in the | This file specifies the preferred style for kernel source files in the | ||||
.Fx | .Fx | ||||
▲ Show 20 Lines • Show All 244 Lines • ▼ Show 20 Lines | |||||
.Vt u_intXX_t . | .Vt u_intXX_t . | ||||
New code should use the former, and old code should be converted to | New code should use the former, and old code should be converted to | ||||
the new form if other major work is being done in that area and | the new form if other major work is being done in that area and | ||||
there is no overriding reason to prefer the older | there is no overriding reason to prefer the older | ||||
.Bx Ns -style . | .Bx Ns -style . | ||||
Like white-space commits, care should be taken in making | Like white-space commits, care should be taken in making | ||||
.Vt uintXX_t | .Vt uintXX_t | ||||
only commits. | only commits. | ||||
.Pp | |||||
Similarly, the project is slowly moving to use the | |||||
.St -isoC-99 | |||||
.Vt bool | |||||
in preference to the older | |||||
.Vt int | |||||
or | |||||
.Vt boolean_t . | |||||
New code should use | |||||
.Vt bool , | |||||
and old code may be converted if it is | |||||
reasonable to do so. | |||||
Literal values are named | |||||
.Dv true | |||||
and | |||||
.Dv false . | |||||
These are preferred to the old spellings | |||||
.Dv TRUE | |||||
and | |||||
.Dv FALSE . | |||||
Userspace code should include | |||||
.In stdbool.h , | |||||
while kernel code should include | |||||
.In sys/types.h . | |||||
.Pp | .Pp | ||||
Enumeration values are all uppercase. | Enumeration values are all uppercase. | ||||
.Bd -literal | .Bd -literal | ||||
enum enumtype { ONE, TWO } et; | enum enumtype { ONE, TWO } et; | ||||
.Ed | .Ed | ||||
.Pp | .Pp | ||||
The use of internal_underscores in identifiers is preferred over | The use of internal_underscores in identifiers is preferred over | ||||
camelCase or TitleCase. | camelCase or TitleCase. | ||||
▲ Show 20 Lines • Show All 560 Lines • Show Last 20 Lines |