C++ Logo

liaison

Advanced search

Re: [isocpp-wg14/wg21-liaison] [SC22WG14.26035] constexpr atomic in C++ compatibility concerns

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 27 Jun 2024 19:28:14 +0300
On Thu, 27 Jun 2024 at 00:02, Niall Douglas <s_sourceforge_at_[hidden]> wrote:
> We have layout compatibility between `_Atomic` and its equivalent
> `std::atomic<>`

I don't think we actually do. Or, quoth a vendor, "No. It's qoi and
GCC fails at it in some cases".

> and in real world code in a mixed C and C++ codebase
> people rely on the above functions being interchangeable when operating
> on the same memory i.e. a header file might declare a struct member as
> `std::atomic` if `__cplusplus`, and `_Atomic` if not.

Right, but making those functions constexpr in C++ doesn't change the layout
of anything, and it doesn't change the runtime behavior of anything,
so the functions remain interoperable on platforms where they
are interoperable to begin with.

Received on 2024-06-27 16:28:27