which language / platform doesn't have a fixed

2019-07-29 11:36发布

问题:

does some language or platform not have a fixed size of stack and therefore not easy to overflow? I remember using C on UNIX, the stack was difficult to overflow while back in the days of Win 3.1, the stack was very easy to overflow.

回答1:

If by "stack" you mean any old stack, most languages do-- Java has a stack class limited only by memory. More likely you mean the call stack, in which case the biggest example I can think of is Stackless Python, which, to my understanding, uses a pure-python memory-limited stack (like Java's) as the call stack for Python code, rather than using C's call stack.



回答2:

this is a question of the practical vs the theoretical. the stack of a lisp interpreter is limited only by available memory

in scheme and other languages that implement tail recursion, a tail recursive function would have an infinite stack



回答3:

Mac Systems 6, 7, and 8 had call stacks that could grow without artificial limit.

It also has no guaranteed way to detect a stack--heap collision, and could get you into all kinds of trouble that way...