On Tuesday, 8 May 2012 at 07:03:35 UTC, Gor Gyolchanyan wrote:
Cool! Thanks! I'l definitely check it out! I hope it's DDOCed :-D
I just invented an absolutely wicked way of using alloca() in the parent context... unfortunately frame_size is static but with some work, it's still an usable method since it's mutable!
struct Wicked { static int frame_size = 0; auto Create(void* buf=alloca(frame_size)) { for(byte i=0;i<frame_size;++i) (cast(byte*)buf)[i]=i; struct Frame { size_t size; } Frame* xxx = cast(Frame*)buf; xxx.size=frame_size; return xxx; } @disable this(); this(size_t size) { frame_size = size; } }