Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Feb 2020 14:45:02 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        John Baldwin <jhb@freebsd.org>, svn-src-head@freebsd.org
Cc:        Warner Losh <imp@bsdimp.com>
Subject:   Re: svn commit: r358392 - head/share/man/man9
Message-ID:  <217D39BA-4FDC-490C-8490-533D244E79CE@yahoo.com>
References:  <217D39BA-4FDC-490C-8490-533D244E79CE.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin jhb at FreeBSD.org wrote on
Thu Feb 27 16:55:01 UTC 2020:

> 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
> >=20
> > Log:
> >   _Static_assert is to be preferred to CTASSERT.
> >  =20
> >   Document the existing prefernce that _Static_assert be used in =
preference to the
> >   old CTASSERT we used to use for compile time assertions.
>=20
> 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.
>=20

Be warned static_assert is a C++ keyword as of C++11.

c++11 added: static_assert(bool_constexpr,message)
c++17 added: static_assert(bool_constexpr)

C11 added _Static_assert(expression,message)
C2x gets  _Static_assert(expression)

C11 added "#define static_assert _Static_assert" to <assert.h>

It makes for a bit of a mess in code to be allowed
to be processed by both C and C++.

The wording may need to specify enough to tell what to
do for such code and the headers may need logic to
cause that context to exist across both languages
when the header is allowed for both.

=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?217D39BA-4FDC-490C-8490-533D244E79CE>