style.9: Add a small blurb about allowing bool
It was allowed before, but make it very explicit it is allowed now. And prefer 'bool' to older types that were used for the same purpose -- int and boolean_t. Like with the C99 fixed-width types, use common sense when changing old code. No igor regressions. Suggested by: bde <20151205031713.T3286@besplex.bde.org> Reviewed by: glebius, davide, bapt (earlier versions) Reviewed by: imp Feedback from: julian Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D4384
This commit is contained in:
parent
259fb883db
commit
3f07044f5b
@ -26,7 +26,7 @@
|
||||
.\" From: @(#)style 1.14 (Berkeley) 4/28/95
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd November 22, 2015
|
||||
.Dd December 5, 2015
|
||||
.Dt STYLE 9
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -288,6 +288,30 @@ Like white-space commits, care should be taken in making
|
||||
.Vt uintXX_t
|
||||
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
|
||||
Enumeration values are all uppercase.
|
||||
.Bd -literal
|
||||
enum enumtype { ONE, TWO } et;
|
||||
|
Loading…
x
Reference in New Issue
Block a user