I think the TMP_ALLOC is more trouble than it's worth. The alternative is, in every case, have a modest fixed-size local array; use that, or `malloc' if needed, later `free' if needed. Advantages are: a) does not crash b) may help optimizer c) stack use is quite modest in all cases d) one less non-portable thing I volunteer to do this work, if people think that it's a good idea.