76
19
Write a program that throws a StackOverflow Error or the equivalent in the language used. For example, in java, the program should throw java.lang.StackOverflowError.
You are not allowed to define a function that calls itself or a new class(except the one containing main in java). It should use the classes of the selected programming language.
And it should not throw the error explicitly.
Is this even possible in JS? – Cyoce – 10 years ago
4I don't understand "use the classes of the selected programming language" – Prince John Wesley – 13 years ago
3Is it ok to define a function that calls inner function like this
def s{def t=s;t}? – Prince John Wesley – 13 years ago12In most languages, classes are only a special kind of data structure, not the center of the universe. Many don't even have such a thing. – ceased to turn counterclockwis – 13 years ago
1
The funny thing here is that languages that require tail recursion elimination (and implementations that support it when the languages does not require it)---which are in a very real sense better---are at a disadvantage on this. TwiNight's answer links to the version of this that exists on Stack Overflow from the early days.
– dmckee --- ex-moderator kitten – 13 years ago@PrinceJohnWesley, I wanted to say to use the structures/functions of the programming language, not to define something new; to avoid answers like define a function which calls itself. – True Soft – 13 years ago
I wonder if certain Math Errors in calculators could be called stackoverflows, if so then
99!would be a very short one on my casio – Griffin – 13 years agoDoes a compile-time overflow violate the rules at all? – Andrew Gray – 13 years ago
1
From the java doc: Thrown when a stack overflow occurs because an application recurses too deeply. http://docs.oracle.com/javase/6/docs/api/java/lang/StackOverflowError.html
– jsedano – 13 years ago