C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Attribute [[discard]] and attributes on expressions

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Thu, 12 Oct 2023 15:57:09 +0200
As Arthur wrote, you probably do not want to have [[maybe_unused]] active for SOME_PLATFORM, too.   Of course you could also #ifdef the maybe_unused attribute in this specific example as an alternative solution, which arguably would not make it more readable.   -----Ursprüngliche Nachricht----- Von:Giuseppe D‘Angelo via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Do 12.10.2023 15:48 Betreff:Re: [std-proposals] Attribute [[discard]] and attributes on expressions Anlage:untitled An:std-proposals_at_[hidden]; CC:Giuseppe D‘Angelo <giuseppe.dangelo_at_[hidden]>; On 12/10/2023 15:12, Sebastian Wittmeier via Std-Proposals wrote: > template <typename... Args> > void foo_other_platform([[maybe_unused]] Args... args) > { > } > > template <typename... Args> > void foo(Args... args) > { > #if SOME_PLATFORM >        use(args...); > #else >        foo_other_platform(args...); > #endif > } I don't get it -- why having `foo_other_platform` at all? [[maybe_unused]] is already doing the right thing, just put it on `foo`'s arguments? -- Giuseppe D'Angelo -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-10-12 13:57:11