C++ Logo

std-proposals

Advanced search

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

From: Bjorn Reese <breese_at_[hidden]>
Date: Thu, 12 Oct 2023 16:09:22 +0200
On 10/12/23 14:49, Giuseppe D'Angelo via Std-Proposals wrote:

> But this can be spelled like this today, without discarding:
>
>> template <typename... Args>
>> void foo([[maybe_unused]] Args... args)
>> {
>> #if SOME_PLATFORM
>> use(args...);
>> #endif
>> }

It is not quite the same:

template <typename... Args>
void foo([[maybe_unused]] Args... args)
{
#if SOME_PLATFORM
     // I get no warning if I forget to use args... here
#endif
}

Received on 2023-10-12 14:09:24