Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Nov 2011 10:32:03 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Cc:        Zack Kirsch <zack@freebsd.org>, mdf@freebsd.org
Subject:   Re: Use of bool / stdbool.h in kernel
Message-ID:  <201111301032.04102.jhb@freebsd.org>
In-Reply-To: <20111130154604.B949@besplex.bde.org>
References:  <CAMBSHm_Be0hCimgg0KpCFs24MHOW=LBczJbFZ3F1cOaCgrS8LA@mail.gmail.com> <20111130154604.B949@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, November 30, 2011 12:13:53 am Bruce Evans wrote:
> On Tue, 29 Nov 2011 mdf@freebsd.org wrote:
> 
> > At $WORK we have a hack in one of the *.mk files to allow including
> > stdbool.h in the kernel and we use it extensively.  This is not
> > allowed by style(9), as far as I can tell, because the file is in
> > include/stdbool.h and those files are not allowed to be included in
> > kernel sources.
> 
> Including stdbool.h in the kernel is not a style bug, but unsupported.
> 
> > What I want to check on is, would it be acceptable to move stdbool.h
> > from include/stdbool.h to sys/sys/stdbool.h (i.e. like errno.h) and
> > then include it in the kernel as <sys/stdbool.h>?  That is, is the
> 
> Would be a larger style bug, especially if it were actually used.
> Even its spellings of TRUE and FALSE are strange.  Even in userland
> stdbool.h is considered so useful that it is never used in src/bin
> and is only used a few times on other src/*bin.  src/bin never uses
> TRUE of FALSE either.

I suspect there is some bias here though due to the fact that there wasn't
a standard bool type when most of this code was written. :)  I don't think
that means we have to forgo use of the new type now that it is in fact
standardized in C99.  I would be happy to have 'bool' available and the
lowercase 'true' and 'false' are fine with me.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111301032.04102.jhb>