Thread overview
Using alloca?
Jun 28, 2013
Marco Leise
Jun 28, 2013
Benjamin Thaut
Jun 28, 2013
bearophile
Jun 28, 2013
Benjamin Thaut
June 28, 2013
I'd like to stack-allocate an array that will be dynamically sized. Is alloca somewhere in the standard D library? If so, what should I import to have access to it?
June 28, 2013
On 6/27/13 9:42 PM, Maxime Chevalier-Boisvert wrote:
> I'd like to stack-allocate an array that will be dynamically sized. Is
> alloca somewhere in the standard D library? If so, what should I import
> to have access to it?

Yah, import core.stdc.stdlib.

Andrei
June 28, 2013
Am Fri, 28 Jun 2013 06:42:31 +0200
schrieb "Maxime Chevalier-Boisvert"
<maximechevalierb@gmail.com>:

> I'd like to stack-allocate an array that will be dynamically sized. Is alloca somewhere in the standard D library? If so, what should I import to have access to it?

As a side note, in Mono-D you can just type alloca, then press Ctrl+Alt+Space and the correct import magically appears at the top of the source file.

-- 
Marco

June 28, 2013
On Friday, 28 June 2013 at 05:27:54 UTC, Andrei Alexandrescu wrote:
> On 6/27/13 9:42 PM, Maxime Chevalier-Boisvert wrote:
>> I'd like to stack-allocate an array that will be dynamically sized. Is
>> alloca somewhere in the standard D library? If so, what should I import
>> to have access to it?
>
> Yah, import core.stdc.stdlib.
>
> Andrei

Thank you good sir :)
June 28, 2013
Am 28.06.2013 06:42, schrieb Maxime Chevalier-Boisvert:
> I'd like to stack-allocate an array that will be dynamically sized. Is
> alloca somewhere in the standard D library? If so, what should I import
> to have access to it?

The last time I checked alloca did not work well together with execptions. Whenever a exception whas thrown thourgh a stack frame which used alloca the app would crash. (on dmd Windows 64 bit, which uses the same exception mechanism as the linux versions of dmd)


-- 
Kind Regards
Benjamin Thaut
June 28, 2013
Benjamin Thaut:

> The last time I checked alloca did not work well together with execptions. Whenever a exception whas thrown thourgh a stack frame which used alloca the app would crash. (on dmd Windows 64 bit, which uses the same exception mechanism as the linux versions of dmd)

Is this in Bugzilla?

Bye,
bearophile
June 28, 2013
Am 28.06.2013 20:01, schrieb bearophile:
> Benjamin Thaut:
>
>> The last time I checked alloca did not work well together with
>> execptions. Whenever a exception whas thrown thourgh a stack frame
>> which used alloca the app would crash. (on dmd Windows 64 bit, which
>> uses the same exception mechanism as the linux versions of dmd)
>
> Is this in Bugzilla?
>
> Bye,
> bearophile

Yes, its a pretty old bug too:

http://d.puremagic.com/issues/show_bug.cgi?id=3753

-- 
Kind Regards
Benjamin Thaut