Is NRVO part of the spec?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Feb 7 07:02:43 PST 2015


On 2/7/15 6:35 AM, Daniel Murphy wrote:
> "Peter Alexander"  wrote in message
> news:uiqnamficseklfowmkyf at forum.dlang.org...
>
>> I'm writing a blog post about why we don't need rvalue references in
>> D. It seems that we rely on NRVO being performed, not just as an
>> optimization, but for correct semantics (e.g. for objects without
>> destructors or postblits). This doesn't appear to be documented anywhere.
>>
>> Is it meant to be part of the spec?
>
> NRVO isn't required for correct semantics, as structs can be moved with
> bitcopy.

It is required for structs that disable postblit. -- Andrei



More information about the Digitalmars-d mailing list