C++ Logo

std-proposals

Advanced search

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

From: Edward Catmur <ecatmur_at_[hidden]>
Date: Fri, 6 Oct 2023 09:20:50 -0600
gcc has a function attribute [[gnu::warn_unused_result]] that is "stronger"
than [[nodiscard]] in that it cannot be suppressed by cast to void
(unfortunately, clang claims to support it but didn't get that part of the
memo, causing confusion and frustration); that attribute has been used for
some time on the interface of the GNU libc. GNU continue to use it in
preference to [[nodiscard]] precisely because (when using the GNU C and C++
compilers) it cannot be suppressed by cast to void.

Do you have an opinion on whether that implementation-specific attribute's
warning should also be suppressed by [[discard]]?

Thanks, Ed

On Thu, Oct 5, 2023, 14:03 Giuseppe D'Angelo via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Hello,
>
> Hoping that EWGI will reconvene in Kona, I have prepared a proposal to
> allow attributes on expressions, and also proposes the [[discard]]
> attribute. It is a draft ... of a draft -- there's still some design
> work to be done, possibly with EWG(I) help.
>
> https://isocpp.org/files/papers/D2992R0.html
>
> As usual, any early feedback is very much appreciated.
>
> --
> Giuseppe D'Angelo
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-10-06 15:21:03