C standard library alloca function has an undefined behavior when
requested size is large enough to cause a stack overflow, but many (good)
implementations return null instead. So does DMD, for example. I believe
it would be even better to go ahead and enforce D implementation to return
a GC allocated chunk of memory instead of null in that case. It will not
incur any performance hit in 99.9% of the cases and prevent a bug from
being happen in the rest. It will also make writing code using it easier
(and more safe), since you don't have to worry about possible stack
overflow/null-dereference.
- Making alloca more safe Denis Koroskin
- Re: Making alloca more safe Walter Bright
- Re: Making alloca more safe bearophile
- Re: Making alloca more safe Andrei Alexandrescu
- Re: Making alloca more safe dsimcha
- Re: Making alloca more safe Denis Koroskin
- Re: Making alloca more safe Andrei Alexandrescu
- Re: Making alloca more safe Yigal Chripun
- Re: Making alloca more s... Andrei Alexandrescu
- Re: Making alloca more safe Denis Koroskin
- Re: Making alloca more s... Andrei Alexandrescu