Feedback Thread: DIP 1040--Copying, Moving, and Forwarding--Community Review Round 1

deadalnix deadalnix at gmail.com
Mon Mar 8 21:47:18 UTC 2021


On Monday, 8 March 2021 at 10:27:07 UTC, Walter Bright wrote:
> What the DIP should make clear, however, is that changing 
> copies to moves should be regarded as implementation dependent, 
> i.e. it is a mistake if the user attempts to rely on a 
> particular sequence of moves and copies. Much like relying on 
> this for NRVO is a mistake. NRVO has always been an optional 
> optimization, and if it happens or not is difficult to 
> determine just by looking at the code. In practice, the only 
> problem that has cropped up has been pressure to find more 
> cases where NRVO can be applied, so I think we're good with 
> labeling the copy=>move semantics as an 
> implementation-dependent optimization.

That seems like the best approach. It allows for thing like fixed 
point analysis to bail in case it needs too many iterations. In 
this case, the list of cases presented should be presented as 
examples rather than spec.


More information about the Digitalmars-d mailing list