C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Ignoring attributes

From: Andrey Semashev <andrey.semashev_at_[hidden]>
Date: Mon, 24 Mar 2025 17:02:54 +0300
On 3/24/25 15:26, Marcin Jaczewski via Std-Proposals wrote:
>
> If we want not-ignorable attributes it should be explicit and know
> upfront even if compiler is 10y old.
> I would suggest change syntax a bit and add `!!` to attribute to mark
> it required:
>
> ```
> [[!!no_unique_address]] int foo;
> ```
>
> or
>
> ```
> [[!!(gnu::packed, clang::packed)]] class Foo;
> ```
>
> If the compiler does not recognize and support any attribute from this
> it should break compilation.

This won't work because current compilers are required to ignore such
attributes.

If you want mandatory attributes, they should use a syntax that is
invalid with older compilers.

Received on 2025-03-24 14:02:59