C++ Logo

std-discussion

Advanced search

Re: [[maybe_unused]] classes

From: Andrew Tomazos <andrewtomazos_at_[hidden]>
Date: Fri, 21 Apr 2023 08:04:46 +1000
On Thu, Apr 20, 2023 at 4:18 PM Stephan Bergmann <sbergman_at_[hidden]>
wrote:

> "A nice placeholder with no name", making _ variables implicitly
> maybe_unused, would nicely cover at least the guard variable scenario;
> and in general it might be better to let maybe_unused consistently
> affect only the marked entity.)
>

Sorry, what's the "guard variable scenario" ?

You mean like `std::lock_guard` for example?

Such variables have non-trivial destructors, so the implementations will
not warn that they are unused. They don't need to be marked
[[maybe_unused]].

Received on 2023-04-20 22:04:59