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.

Reply via email to