This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Deprecating arithmetic on std::atomic<void*>
- From: Ville Voutilainen <ville dot voutilainen at gmail dot com>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: gcc at gcc dot gnu dot org, "libstdc++" <libstdc++ at gcc dot gnu dot org>
- Date: Wed, 19 Apr 2017 20:43:02 +0300
- Subject: Re: Deprecating arithmetic on std::atomic<void*>
- Authentication-results: sourceware.org; auth=none
- References: <20170419170736.GY3412@redhat.com>
On 19 April 2017 at 20:07, Jonathan Wakely <jwakely@redhat.com> wrote:
> I know it's a bit late, but I'd like to propose deprecating the
> libstdc++ extension that allows arithmetic on std::atomic<void*>.
> Currently we make it behave like arithmetic on void*, which is also a
> GNU extension (https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html).
> We also allow arithmetic on types such as std::atomic<void(*)()> which
> is probably not useful (PR 69769).
>
> C++11 and C++14 were silent on the matter, but C++17 makes it
> explicitly ill-formed (see https://wg21.link/p0558r1 page 2). I'm
> implementing that for C++17 mode but would like it to be ill-formed
> for all modes in a future release.
>
> So I'd like to apply this patch to the gcc-7/changes.html page:
>
> --- htdocs/gcc-7/changes.html 17 Apr 2017 22:12:35 -0000 1.77
> +++ htdocs/gcc-7/changes.html 19 Apr 2017 17:05:27 -0000
> @@ -38,6 +38,10 @@
> </li>
>
> <li>The Cilk+ extensions to the C and C++ languages have been
> deprecated.</li>
> +
> + <li>The extension allowing arithmetic on
> <code>std::atomic<void*></code>
> + and types like <code>std::atomic<R(*)()></code>
> + has been deprecated.</li>
> </ul>
>
> <!-- .................................................................. -->
>
>
> Does this seem reasonable, or do people think we need to keep this
> feature, to match the core language extensions?
>
I think it's reasonable. If users report massive concerns, we can
certainly un-deprecate it.
At the moment all that deprecation is doing for non-C++17 modes is
giving users a fair warning
of things to be aware of, and we can get feedback on that.