[Issue 14152] New: Document when function returns are moves vs. copies

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Feb 8 13:45:22 PST 2015


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 at puremagic.com
          Reporter: peter.alexander.au at 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

--


More information about the Digitalmars-d-bugs mailing list