`in` parameters made useful

Rainer Schuetze r.sagitario at gmx.de
Tue Aug 4 18:42:15 UTC 2020

On 04/08/2020 11:35, Mathias LANG wrote:
> On Saturday, 1 August 2020 at 07:48:10 UTC, Rainer Schuetze wrote:
>> Maybe we can leverage that and define that if the ABI uses a reference
>> for an `in`-value, the compiler may/must elide an extra copy. That
>> avoids having to define our own rule set.
> Do you have a link ? I did some research beforehand, but all I could
> find was about NRVO and throwing exception, nothing about actually
> promoting values to references.
> Itanium C++ ABI doesn't have anything:
> https://itanium-cxx-abi.github.io/cxx-abi/abi.html#value-parameter

Well, this already says as much for non-POD data IIUC.

The System V ABI for C that is used for PODs doesn't seem to use
references, though.

> Nor does MS:
> https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention?view=vs-2019#parameter-passing

This says for non-register-sized data: "Structs or unions of other sizes
are passed as a pointer to memory allocated by the caller."

More information about the Digitalmars-d mailing list