C++ Logo


Advanced search

Re: [wg14/wg21 liaison] [isocpp-core] Ignorability of attributes: draft wording, and concern about __has_c_attribute

From: Timur Doumler <cpp_at_[hidden]>
Date: Wed, 8 Feb 2023 07:36:39 -0800
> On 8 Feb 2023, at 07:33, Timur Doumler <cpp_at_[hidden]> wrote:
>> Attributes themselves (the bits within the [[]]) are not portable,
>> even for the standard attributes.
> Exactly, So if you, as the user, rely on whether or not the semantics of the attribute kick in, and whether or not they will break your ABI, you have already lost, regardless of how __has_cpp_attribute is specified.

To emphasise what I am saying here:

If you want a [[no_unique_address]] where you can rely on the attribute changing (or not changing) the ABI of a class, and branch on that, then it should not be an attribute. It should be a keyword instead. Just like `alignas`. This is not what attributes are for IMHO.


Received on 2023-02-08 15:36:45