Walter Bright: > A person using alloca is expecting stack allocation, and > that it goes away after the function exits. Switching arbitrarily to the > gc will not be detected and may hide a programming error (asking for a > gigantic piece of memory is not anticipated for alloca, and could be > caused by an overflow or logic error in calculating its size).
There's another solution, that I'd like to see more often used in Phobos: you can add another function to Phobos, let's call it salloca (safe alloca) that does what Denis Koroskin asks for (it's a very simple function). Bye, bearophile
