v0.175
なんかscope付けたらスタックに確保してくれるようです。
>type con > a.d class X{int a[1000000];} void main(){scope x = new X;} ^Z >dmd a.d >a.exe Error: Stack Overflow
おー本当だー。
これで効率を気にして
import std.c.stdlib; class X{ new(uint sz,void*p){return p;} } void main(){ auto X x = new(alloca(X.classinfo.init.length)) X; }
こんな無駄なコード書く手間が省けますね。
素晴らしい