[gsoc] DMD - Ideas

Mike Franklin slavo5150 at yahoo.com
Thu Mar 7 14:47:25 UTC 2019


On Thursday, 7 March 2019 at 09:53:13 UTC, Seb wrote:
> @community: what other features do you miss the most from DMD 
> that could be done in the span of a GSoC?

`alloca` cannot be used without linking in druntime [1], and 
`scope` arrays should allocate on the stack [2]

In DMD `alloca` is implemented in druntime, so to do dynamic 
stack allocation, one must link in druntime.  -betterC does not 
link in the druntime, so dynamic stack allocation cannot be done 
in -betterC compiled code.  This is only a limitation of DMD, 
however; GDC and LDC can both do dynamic stack allocation without 
linking in druntime.

Also, it is odd that `scope` classes are allocated on the stack, 
but `scope` arrays are not.  My understanding is that allocating 
`scope` classes on the stack is done only as an optimization, but 
I don't see why that optimization wouldn't apply equally well to 
`scope` arrays.

Mike

[1] https://issues.dlang.org/show_bug.cgi?id=19159
[2] https://issues.dlang.org/show_bug.cgi?id=18788


More information about the Digitalmars-d mailing list