C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [Draft Proposal] Required attribute syntax

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Thu, 4 May 2023 11:40:36 +0100
On Thu, 4 May 2023 at 11:22, Lauri Vasama via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> The fact is that there are programs which behaviours depend on whether the
> implementation chooses to ignore this particular attribute or not. Perhaps
> that is fine, but perhaps not. As noted in the draft proposal, Microsoft
> has also been unwilling to implement [[no_unique_address]] in its ignorable
> form because it would cause an insidious ABI incompatibility depending on
> the language standard in use.
>

How does your proposal help with that? Assuming your proposal got into
C++26, you wouldn't be able to use [[!no_unique_address]] in C++23 or
older, so you'd have exactly the same problem.

struct A {
#if __cplusplus >= 202600
[[!no_unique_address]]
#endif
  B b;
};

How does this help?

If your intention is to somehow force MSVC to support the attribute, I
don't think your proposal achieves that. They will just refuse to support
the new form as well, because it has the same issues (older versions of
MSVC will not support the attribute, whether "required" or not, and so the
same risk of ABI incompatibility exists for any code using it). So the
proposal is not well motivated.




>
> Thank you for the information regarding the usage of italics. I'll be sure
> to keep that in mind in the future. Certainly the wording here is
> demonstrative at best.
>

Your proposal doesn't mention how __has_cpp_attribute works with required
attributes, or even if it does at all.

Received on 2023-05-04 10:40:50