[PATCH] support: Define support_static_assert for use from C and C++
Florian Weimer
fweimer@redhat.com
Mon Jan 1 03:40:00 GMT 2018
On 01/01/2018 12:40 AM, Paul Eggert wrote:
> Florian Weimer wrote:
>> _Static_assert is reserved in C++ as well, so I don't want to touch
>> it. The GCC headers might eventually use it in a way which is not
>> strictly equivalent to static_assert.
>
> If we don't care about the difference (what is it, by the way?), then
Later C++ versions support a one-argument form. The set of accepted
expressions varies as well, but I think the C++ variant has a superset,
so we should be okay.
> something like this should work:
>
> #ifndef __cplusplus
> # define static_assert _Static_assert
> #endif
>
> since "static_assert" is not reserved in C.
>
> I wish these committees would coordinate better....
At least we control the definition of static_assert in C mode. I'm
still unhappy that we override headers from support/. In this case, it
is probably harmless, but in general, I really dislike this approach,
which is why I invented support_static_assert.
Thanks,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: static_assert.patch
Type: text/x-patch
Size: 3811 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20180101/e6a96eef/attachment.bin>
More information about the Libc-alpha
mailing list