Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Aug 2017 08:14:41 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        Mark Millard <markmi@dsl-only.net>
Cc:        imp@FreeBSD.org, svn-src-head@freebsd.org, FreeBSD Current <freebsd-current@freebsd.org>, FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>, freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   Re: svn commit: r322875 - head/sys/dev/nvme
Message-ID:  <DCD7947D-DA37-4255-A147-4B9E3B1631ED@FreeBSD.org>
In-Reply-To: <1C5A448F-C91A-4599-8500-E4E46E6F5205@dsl-only.net>
References:  <1C5A448F-C91A-4599-8500-E4E46E6F5205@dsl-only.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 25 Aug 2017, at 07:32, Mark Millard <markmi@dsl-only.net> wrote:
>=20
> As I remember _Static_assert is from C11, not
> the older C99.

In pre-C11 dialects of C, _Static_assert is an identifier reserved for =
the implementation.  sys/cdefs.h defines it to generate a zero-length =
array if the condition is true or a negative-length array if it is =
false, emulating the behaviour (though giving less helpful error =
messages)

>=20
> As I understand head/sys/dev/nvme/nvme.h use by
> C++ code could now reject attempts to use
> _Static_assert .

In C++, _Static_assert is an identifier reserved for the implementation, =
but in C++11 or newer static_assert is a keyword.  sys/cdefs.h defines =
_Static_assert to static_assert for newer versions of C++ and defines it =
to the C-before-11-compatible version for C++-before-11.

TL;DR: We have gone to a lot of effort to ensure that these keywords =
work in all C/C++ dialects, please use them, please report bugs if you =
find a case where they don=E2=80=99t work.

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DCD7947D-DA37-4255-A147-4B9E3B1631ED>