Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 2021 20:06:07 +0000
From:      bugzilla-noreply@freebsd.org
To:        standards@FreeBSD.org
Subject:   [Bug 255290] _POSIX_C_SOURCE=200809 hides static_assert
Message-ID:  <bug-255290-99-aCPnWU7TAf@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-255290-99@https.bugs.freebsd.org/bugzilla/>
References:  <bug-255290-99@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D255290

--- Comment #11 from Warner Losh <imp@FreeBSD.org> ---
> As far as I'm aware, C11 does not make any modifications to the standard =
that are incompatible with POSIX 2008, and thus there are no conflicts, and=
 hence, no undefined behavior.

C11 adds things. Those additions intrude into the namespace that POSIX allo=
ws
the user to use. That's where the conflict arises.

The following should be a strictly conforming, even if compiled with C11
compiler, as there's no exception in POSIX for newer versions of C introduc=
ing
new things. The requested change would make it not be.

#define __POSIX_C_SOURCE 200809

#include <assert.h>
#include <stdio.h>

void static_assert(int a, int b, int c)
{ printf("A is %d, b is %d and c is %d\n", a, b, c);}
int main(int argc, char *argv[]) { static_assert(1, 2, 3); exit(0); }

Further, __STDC_VERSION__ is not a feature test macro that the user can def=
ine.
It is a pre-defined macro defined by the compiler, and can't be redefined by
the programmer.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-255290-99-aCPnWU7TAf>