DIP 1016--ref T accepts r-values--Formal Assessment

Walter Bright newshound2 at digitalmars.com
Fri Jan 25 07:08:00 UTC 2019


On 1/24/2019 12:01 PM, kinke wrote:
> `out` params are default-initialized on entry. 
> Ignoring backwards compatibility for a second, I think getting rid of that would 
> actually be beneficial (most args are probably already default-initialized by 
> the callee in the line above the call...)

The compiler should elide the default-initializations before the call (although 
it currently does not).

The 'out' comes from IDL (Interface Definition Language) and by using out 
parameters it is directly convertible to/from IDL.

Even earlier, 'out' comes from Ada (!)

 From an efficiency standpoint, having the initialization occur in the function 
is better than all that duplicated initialization code in all the callers.


More information about the Digitalmars-d-announce mailing list