Date: Tue, 5 Mar 2013 22:21:09 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Gleb Smirnoff <glebius@FreeBSD.org> Cc: Davide Italiano <davide@FreeBSD.org>, src-committers@FreeBSD.org, John Baldwin <jhb@FreeBSD.org>, attilio@FreeBSD.org, Bruce Evans <brde@optusnet.com.au>, svn-src-projects@FreeBSD.org Subject: Re: svn commit: r247710 - projects/calloutng/sys/kern Message-ID: <20130305214655.C1224@besplex.bde.org> In-Reply-To: <20130305094819.GI48089@FreeBSD.org> References: <201303031339.r23DdsBU047737@svn.freebsd.org> <201303041521.06557.jhb@freebsd.org> <CAJ-FndBvLD_fU1ZZ3cGNtChfdtXyuBRt4Z_ci8daS08ZYdOKzg@mail.gmail.com> <201303041620.52100.jhb@freebsd.org> <20130305201211.M902@besplex.bde.org> <20130305094819.GI48089@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 5 Mar 2013, Gleb Smirnoff wrote: > On Tue, Mar 05, 2013 at 08:43:33PM +1100, Bruce Evans wrote: > B> > I think for new code we should prefer C99's bool to boolean_t. > B> > B> Why? There is no existing practice for this in the kernel. There is some > B> in the Linux kernel :-). > > Why? Because it is standard. What for? To make it more easy for newcomers > to start hacking on FreeBSD kernel. I think you mean "harder". Now the newcomers need to know: - the old method, which is used in most places - the new method - style rules for old, new and mixed methods - arcane C99 points like whether bool can be used in bit-fields (I had to look this up to check it. It can). I now see technical reasons to never use bool in kernel or other low-level code. It will cause minor pessimizations converting nonzero to true (1) at runtime, and for converting bool to register_t when passing parameters (bool is 1 byte on x86). To use bool in structs (when not packing it into bit-fields), we need to know too much about its size to pack it properly... Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130305214655.C1224>