This is the mail archive of the
mailing list for the GCC project.
Re: Deprecating arithmetic on std::atomic<void*>
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Jonathan Wakely <jwakely at redhat dot com>, gcc at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Thu, 20 Apr 2017 11:31:23 +0200 (CEST)
- Subject: Re: Deprecating arithmetic on std::atomic<void*>
- Authentication-results: sourceware.org; auth=none
- References: <20170419170736.GY3412@redhat.com> <firstname.lastname@example.org>
- Reply-to: libstdc++ at gcc dot gnu dot org
On Thu, 20 Apr 2017, Florian Weimer wrote:
On 04/19/2017 07:07 PM, Jonathan Wakely 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).
Why is it acceptable to have the extension for built-in types, but not for
library types wrapping them? Why be inconsistent about this?
I thought the extension was there for legacy code, to avoid breaking old
programs, and we could deprecate it eventually. At least the manual is
missing an example of where this extension is actually useful. For atomic,
I don't see why we should encourage people to write new code that violates