Date: Fri, 28 Feb 2020 13:06:18 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Warner Losh <imp@bsdimp.com> Cc: John Baldwin <jhb@freebsd.org>, Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r358392 - head/share/man/man9 Message-ID: <20200228110618.GO29554@kib.kiev.ua> In-Reply-To: <CANCZdfq961mA%2B7bRSMexv96oEiYG7yTPS4s=STO3tGWyr9i7aw@mail.gmail.com> References: <202002271530.01RFUDJA087174@repo.freebsd.org> <5a876bf9-56b5-9465-07f4-2c540313755d@FreeBSD.org> <CANCZdfq961mA%2B7bRSMexv96oEiYG7yTPS4s=STO3tGWyr9i7aw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 27, 2020 at 10:54:21PM -0700, Warner Losh wrote: > On Thu, Feb 27, 2020, 9:55 AM John Baldwin <jhb@freebsd.org> wrote: > > > On 2/27/20 7:30 AM, Warner Losh wrote: > > > Author: imp > > > Date: Thu Feb 27 15:30:13 2020 > > > New Revision: 358392 > > > URL: https://svnweb.freebsd.org/changeset/base/358392 > > > > > > Log: > > > _Static_assert is to be preferred to CTASSERT. > > > > > > Document the existing prefernce that _Static_assert be used in > > preference to the > > > old CTASSERT we used to use for compile time assertions. > > > > Actually, I think what we want to use is static_assert(). The intention in > > userland C is that _Static_assert() is an internal keyword and <assert.h> > > adds static_assert() as an alias, similar to <stdalign.h> defining alignas, > > etc. I think what we should do for the kernel is have <sys/systm.h> define > > map static_assert to _Static_assert and replace existing _Static_assert > > usage with the proper spelling. > > > > I originally did just that when people pointed out that there were hundreds > of instances in the tree of _Static_assert and less than 10 of > static_assert. > > We could do a sweep and change, but I wanted to document it. Even more so > because I was originally mistaken. It could be declared to be a fault of the C standard, but I believe that _Static_assert() use is actually better over static_assert(). The standard defines _Static_assert() as the language feature, while static_assert() comes from the assert.h header that is not required by a freestanding environment. Note that this situation is not similar to _Bool/bool, because stdbool.h is required for conforming freestanding env.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200228110618.GO29554>