C++ Logo

std-proposals

Advanced search

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

From: Oleksandr Koval <oleksandr.koval.dev_at_[hidden]>
Date: Thu, 4 May 2023 12:17:34 +0300
I'm not convinced with the `no_unique_address` example. As any other
attribute, it's optional and doesn't affect the meaning of the program. It
sounds like an error to write a code which relies on an observable behavior
change caused by any attribute. P1774R8 <https://wg21.link/P1774R8> also
discussed a bit about potential observable changes caused by `[[assume]]`.
With such a feature, should we introduce a set of attributes which can and
cannot be required? Like, is it legal to write `[[!nodiscard]]`?
Maybe there's a space for a similar mechanism in the language but I would
not call it "required attributes" because it's just contradictory to the
current meaning of attributes.

On Thu, May 4, 2023 at 11:29 AM Bo Persson via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 2023-05-04 at 09:47, Lauri Vasama via Std-Proposals wrote:
> > Floating an idea i've been toying around with for a while concerning a
> > new syntax for attributes with observable effects on program behaviour.
> >
> > https://vasama.github.io/wg21/Dxxx1 <https://vasama.github.io/wg21/Dxxx1
> >
> >
> >
>
> Don't see that an exclamation mark is a good choice for "required", as
> it elsewhere means "not".
>
> Like [[packed]] is optional, but [[!packed]] should be required packing.
> To me it look more like unpacked.
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>


-- 
Regards,
Oleksandr Koval.

Received on 2023-05-04 09:17:47