finding about move vs copy in C++

Anthony Shipman als@iinet.net.au
Wed Dec 31 10:55:00 GMT 2014


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.



More information about the Gcc-help mailing list