alloca is slow and dangerous

Steven Schveighoffer schveiguy at gmail.com
Mon Jan 4 15:02:32 UTC 2021


On 1/3/21 2:15 PM, welkam wrote:
> On Friday, 1 January 2021 at 17:55:33 UTC, Steven Schveighoffer wrote:
>> D has alloca. It's in core.std.stdlib
>>
>> https://dlang.org/phobos/core_stdc_stdlib.html#.alloca
>>
> Does it work on all compilers and all platforms?

I don't know. I would expect it to work anywhere D is supported. Looking 
at the code, DMD supports it, with GNU it's an intrinsic, and with LDC 
it's given a pragma to tag it (presumably so it can be recognized as an 
intrinsic).

Are there other compilers or platforms that work with D besides DMD, 
LDC, and GDC? Are there some GDC or LDC platforms that don't support 
alloca? If so, it's possible that some don't support it. But it's not 
versioned that way in the code.

-Steve


More information about the Digitalmars-d mailing list