Date: Fri, 6 Oct 2023 17:54:03 +0200
Hello,
On 06/10/2023 17:20, Edward Catmur via Std-Proposals wrote:
> 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]]?
I don't really have *strong* opinion, as this is implementation-specific
behaviour. If I had to pick, I would be prone to say "don't suppress the
warning" (= keep the current behaviour), because that seems to be the
intended purpose of the "stronger" GCC attribute -- to be non-suppressible.
As far as the standard attributes go... `[[really nodiscard]]`?
Thank you,
On 06/10/2023 17:20, Edward Catmur via Std-Proposals wrote:
> 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]]?
I don't really have *strong* opinion, as this is implementation-specific
behaviour. If I had to pick, I would be prone to say "don't suppress the
warning" (= keep the current behaviour), because that seems to be the
intended purpose of the "stronger" GCC attribute -- to be non-suppressible.
As far as the standard attributes go... `[[really nodiscard]]`?
Thank you,
-- Giuseppe D'Angelo
Received on 2023-10-06 15:54:07