www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14152] New: Document when function returns are moves vs. copies

https://issues.dlang.org/show_bug.cgi?id=14152

          Issue ID: 14152
           Summary: Document when function returns are moves vs. copies
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: websites
          Assignee: nobody puremagic.com
          Reporter: peter.alexander.au gmail.com

The language specification makes no mention of when a value will be moved or
copied when returned from a function. This is important not just for
optimization, but for semantics of non-copyable types (e.g. Unique).

Particularly, we need to guarantee:

1. Returning an rvalue does not entail a copy.

2. Last return of a function local variable does not entail a copy.

See discussion:
http://forum.dlang.org/thread/uiqnamficseklfowmkyf forum.dlang.org

--
Feb 08 2015