This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: finding about move vs copy in C++
- From: Anthony Shipman <als at iinet dot net dot au>
- To: "gcc-help" <gcc-help at gcc dot gnu dot org>
- Date: Wed, 31 Dec 2014 21:55:38 +1100
- Subject: Re: finding about move vs copy in C++
- Authentication-results: sourceware.org; auth=none
- References: <201412311919 dot 08618 dot als at iinet dot net dot au> <CAH6eHdQVoOdxOTy775RqCzW=uBe8rgXY+xjYTqMUJQRkBncDBA at mail dot gmail dot com>
On Wed, 31 Dec 2014 09:18:35 pm Jonathan Wakely wrote:
> What exactly are you worried about, the compiler failing to perform
> moves, or your code missing opportunities to move?
>
> The former will very rarely be a problem, the latter can be solved by
> understanding the language better.
>
Well there's the rub. When there may or may not be an automatically generated
move assignment or constructor and the compiler may or may not choose a move
based on the risk of an exception being thrown and with the return value
optimisation etc it's rather difficult to predict exactly what will happen.
Since this is a static decision it would be nice if the compiler could tell
me. Otherwise I have to step through it in gdb to find out what method it is
using.
--
Anthony Shipman Mamas don't let your babies
als@iinet.net.au grow up to be outsourced.