To commemorate the public launch of Stack Overflow, what’s the shortest code to cause a stack overflow? Any language welcome.
ETA: Just to be clear on this question, seeing as I’m an occasional Scheme user: tail-call ‘recursion’ is really iteration, and any solution which can be converted to an iterative solution relatively trivially by a decent compiler won’t be counted. 😛
ETA2: I’ve now selected a “best answer”; see this post for rationale. Thanks to everyone who contributed! 🙂
All these answers and no Befunge? I’d wager a fair amount it’s shortest solution of them all:
Not kidding. Try it yourself: http://www.quirkster.com/iano/js/befunge.html
EDIT: I guess I need to explain this one. The 1 operand pushes a 1 onto Befunge’s internal stack and the lack of anything else puts it in a loop under the rules of the language.
Using the interpreter provided, you will eventually–and I mean eventually–hit a point where the Javascript array that represents the Befunge stack becomes too large for the browser to reallocate. If you had a simple Befunge interpreter with a smaller and bounded stack–as is the case with most of the languages below–this program would cause a more noticeable overflow faster.