[DIP idea] out variables

Afgdr zerzre.rertert at gmx.com
Sat Jan 30 15:55:13 UTC 2021


On Saturday, 30 January 2021 at 07:27:16 UTC, Jacob Carlborg 
wrote:
> On 2021-01-27 19:25, Max Haughton wrote:
>
>> Struct ABI can mean overhead in places you don't expect
>
> If proper tuples are built-in to the language the language can 
> invent its own ABI for that type. Just like it does for arrays 
> and delegates.
>
> On the other hand, there are a bunch of existing C functions 
> that encodes out parameter as pointers.

Totally expected. "out" and "ref" parameters in a backend are 
pointers.
In a front end it's "just" an abstraction that allows special 
checks, typically : 1. accepts only lvalues and 2. dont try 
implicit conversions.
In addition for "out" it adds a zeroinit before the call since as 
it's a kind of return it must be defined even if not modified by 
the callee.


More information about the Digitalmars-d mailing list