alloca without runtime?

岩倉 澪 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu May 4 07:54:58 PDT 2017


On Thursday, 4 May 2017 at 12:50:02 UTC, Kagamin wrote:
> You can try ldc and llvm intrinsics
> http://llvm.org/docs/LangRef.html#alloca-instruction
> http://llvm.org/docs/LangRef.html#llvm-stacksave-intrinsic

Ah, yep!

pragma(LDC_alloca) void* alloca(size_t);

This appears to work with ldc. It would be nice if there was a 
way to do this with dmd/other compilers as well though. If it 
were up to me I'd have alloca defined by the language standard 
and every compiler would have to provide an implementation like 
this. At the very least I'd like to have an alloca that works 
with dmd, as I want to do debug builds with dmd and release 
builds with ldc.


More information about the Digitalmars-d-learn mailing list