C++ Logo


Advanced search

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

From: Lauri Vasama <wg21_at_[hidden]>
Date: Thu, 04 May 2023 13:22:33 +0300
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.

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.

On 4 May 2023, 12:50, at 12:50, Jonathan Wakely via Std-Proposals <std-proposals_at_[hidden]> wrote:
>On Thu, 4 May 2023 at 10:26, Timur Doumler via Std-Proposals <
>std-proposals_at_[hidden]> wrote:
>> Attributes are for ignorable things. I proposed to add an explicit
>> Ignorability Rule to the standard – which we did for C++23:
>> Now, no_unique_address is a class layout hint. It is to composition
>> the Empty Base Optimisation is to inheritance. The EBO is likewise
>not a
>> required optimisation, only an optional one (the only difference
>being that
>> it doesn't have its own annotation). More generally, the standard
>> require any particular class layout in any particular scenario. Your
>> should not portably rely on a particular class layout. Considering
>> I'm not sure it makes sense to have a non-ignorable
>And if you really do require a particular layout when using
>[[no_unique_address]], knowing that doing so is not portable, then you
>use a static_assert to ensure that you get that layout.
>"The non-required forms of any existing standard attributes with
>effects on
>program behaviour, such as no_unique_address, should also be
>deprecated" --
>that would be a serious breaking change for questionable benefit.
>w.r.t your proposed wording, you've introduced a new grammar but
>said what it means. A term should be in italics when it's defined, not
>it's used. You're using the new term "required attribute"in italics,
>you never define it anywhere. Presumably you wanted to say that when
>the !
>is present in an attribute, it's a required attribute, but you haven't
>actually said that.
>Std-Proposals mailing list

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