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

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Feb 8 23:42:51 UTC 2019


On Fri, Feb 08, 2019 at 11:34:47PM +0000, Dennis via Digitalmars-d-announce wrote:
> On Friday, 8 February 2019 at 23:02:34 UTC, Nicholas Wilson wrote:
> > Immediately called lamdas are always inlined.
> 
> ```
> extern(C) void main() {
>     int a = (() => 1)();
> }
> ```
> 
> dmd -inline -O -release -betterC
> 
> asm:
> ```
> main:
> 		push	RBP
> 		mov	RBP,RSP
> 		call	qword ptr pure nothrow @nogc @safe int
> onlineapp.main().__lambda1()@GOTPCREL[RIP]
> 		xor	EAX,EAX
> 		pop	RBP
> 		ret
> ```
> 
> https://run.dlang.io/is/lZW9B6
> 
> Still a lambda call :/

Does LDC/GDC inline it?

I no longer trust dmd for codegen quality. :-/


T

-- 
Customer support: the art of getting your clients to pay for your own incompetence.


More information about the Digitalmars-d-announce mailing list