[Issue 18788] static arrays with a length specified at runtime should dynamically allocate on the stack
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 16 08:58:35 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18788
anonymous4 <dfj1esp02 at sneakemail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |betterC, performance
See Also| |https://issues.dlang.org/sh
| |ow_bug.cgi?id=16037
--- Comment #8 from anonymous4 <dfj1esp02 at sneakemail.com> ---
(In reply to Mike Franklin from comment #5)
> Another way of achieving the same result would be to make a `scope`d dynamic
> array allocate on the stack
>
> ---
> class C { }
>
> void main()
> {
> scope C c = new C(); // `c` is allocated on the stack
> scope int[] i = [1, 2, 3]; // `i` is inconsistently allocated on the heap
> }
Ideally yes, but see discussion in issue 16037.
--
More information about the Digitalmars-d-bugs
mailing list