This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Moving to C++11
- From: Richard Sandiford <richard dot sandiford at arm dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>, Jonathan Wakely <jwakely dot gcc at gmail dot com>, nick <xerofoify at gmail dot com>, gcc Mailing List <gcc at gcc dot gnu dot org>
- Date: Thu, 26 Sep 2019 19:32:10 +0100
- Subject: Re: Moving to C++11
- References: <5dfb5453-8dee-5e12-c24d-0e1e81f40501@gmail.com> <CAH6eHdRthBRC2Xc9EM96pUh9tmBeeE45GofvKCf6k=37qwWKwg@mail.gmail.com> <CAFiYyc3xqNgM31CfikLkb+CGPo3LVC1JkF2v-kiP6p4De9L0Eg@mail.gmail.com> <CADzB+2=usL_53q1sZJC=rLK8omTjXW_xj6jgfqqTBxuJ3C3dcQ@mail.gmail.com> <87y2ybeyf7.fsf@tromey.com>
Tom Tromey <tom@tromey.com> writes:
>>>>>> "Jason" == Jason Merrill <jason@redhat.com> writes:
>
> Jason> Note that std::move is from C++11.
>
>>> I'm not too worried about requiring even a C++14 compiler, for the
>>> set of products we still release latest compilers we have newer
>>> GCCs available we can use for building them (even if those are
>>> not our primary supported compilers which would limit us to
>>> GCC 4.8).
>
> Jason> I wouldn't object to C++14, but there's nothing in there I
> Jason> particularly want to use, so it seems unnecessary.
>
>>> Note I'd still not like to see more C++ feature creep into general
>>> non-container/infrastructure code, C++ is complex enough as-is.
>
> Jason> I agree for rvalue references. I want to start using C++11 'auto' in
> Jason> local variable declarations.
>
> FWIW in gdb we went with C++11, because it was the version that offered
> the most useful upgrades -- for me those was mainly move and foreach,
> but 'auto' is sometimes nice as well.
FWIW, on top of what's already been mentioned:
- "= default" would be very useful for some of the core types
- explicit conversion operators would avoid dangerous implicit conversions
to things like bool. E.g. it should be safe to provide an explicit
operator bool() for poly_int and avoid those pesky known_eq (..., 0)/
maybe_ne (..., 0) conditions
- templated type aliases would simplify wide_int
Richard