C++2a synchronisation inefficient in GCC 11

Jonathan Wakely jwakely@redhat.com
Wed Mar 3 14:24:45 GMT 2021


On 26/02/21 15:53 -0800, Thiago Macieira via Libstdc++ wrote:
>On Friday, 26 February 2021 10:47:09 PST Ville Voutilainen wrote:
>> On Fri, 26 Feb 2021 at 20:43, Thiago Macieira via Libstdc++
>>
>> <libstdc++@gcc.gnu.org> wrote:
>> > Oh? That's not a really widely understood fact. I see people using C++20
>> > right now all the time in the cpplang slack and no one seems to be
>> > worried that support is experimental.
>>
>> People writing toys on forums is not real production use that we
>> should worry about, and anyone who uses
>> a two-months-old standard in production use is going to survive
>> possible breaking changes. Or if they won't,
>> that's their stupid fault.
>
>Think about this scenario. Let's say GCC 12 declares to C++20 support to be
>non-experimental.
>
>Then someone writes a production tool that does:
>
>#if __cpp_lib_atomic_wait >= 201907L
>    a.wait(n);
>#else
>    fallback(a);
>#endif

I agree this is a problem. One created by the feature test macros
(because bfore they were added, you just had to figure out which
version was OK to use for yourself and test __GNUC__ or similar).

But it's not a new problem for GCC 11, and not specific to the atomic
wait feature. It's worth further consideration though.




More information about the Libstdc++ mailing list