C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Ignoring attributes

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Mon, 24 Mar 2025 15:48:04 +0100
Please not. Those are not feature queries, but attributes.   What is [[no_unique_address || indeterminate]]?     Also: !! should be well distinguished from NOT and logical operations One can interpret it as double negation, but do not introduce negation, too   -----Ursprüngliche Nachricht----- Von:Marcin Jaczewski via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Mo 24.03.2025 15:37 Betreff:Re: [std-proposals] Ignoring attributes An:std-proposals_at_[hidden]; CC:Marcin Jaczewski <marcinjaczewski86_at_[hidden]>; pon., 24 mar 2025 o 15:03 Andrey Semashev via Std-Proposals <std-proposals_at_[hidden]> napisał(a): > > 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. Whole point is that it is invalid now, GCC and Clang fail at parsing it. They can't ignore that they can't parse correctly. And when they start parsing this new format, they can obey rules that standard will impose on `!!`. After sending previous email I think about this bit more and come to conclusion that `!!( ... )`  should allow `&&` and `||` as sometimes different compiler attributes could not overlap: ``` [[!!( X::FeatureAB || (Y::FeatureA && Y::FeatureB) ) ]] class A; ``` Now under compiler `X` it require one feature but on compiler `Y` two, but combination of them make class ABI compatible with compiler `X` output. > > -- > Std-Proposals mailing list > Std-Proposals_at_[hidden] > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-03-24 14:53:34