[PATCH v5 1/1] <sys/tagged-address.h>: An API for tagged address
H.J. Lu
hjl.tools@gmail.com
Thu Aug 5 17:41:18 GMT 2021
On Thu, Aug 5, 2021 at 10:26 AM Joseph Myers <joseph@codesourcery.com> wrote:
>
> On Thu, 5 Aug 2021, H.J. Lu via Libc-alpha wrote:
>
> > +#ifdef __GNUC__
> > +# if defined __USE_ISOC11 || defined __USE_ISOCXX11
> > +# ifdef __USE_ISOCXX11
> > +# define TAGGED_ADDRESS_ASSERT static_assert
> > +# else
> > +# define TAGGED_ADDRESS_ASSERT _Static_assert
> > +# endif
>
> These __USE_* conditionals say what library features to enable.
> __USE_ISOC11 doesn't imply that C11 language features are available; you
> can use -D_ISOC11_SOURCE with a GCC version too old to support
> _Static_assert.
>
> However, you should be able to rely on _Static_assert when building as C
> (regardless of feature test macros or compiler versions) because of the
> definition in sys/cdefs.h.
I can use _Static_assert directly for C. How should I use static_assert
for C++?
--
H.J.
More information about the Libc-alpha
mailing list