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 – 2016-01-25T06:54:55.637
4I don't understand "use the classes of the selected programming language" – Prince John Wesley – 2013-01-04T15:07:48.463
3Is it ok to define a function that calls inner function like this
def s{def t=s;t}
? – Prince John Wesley – 2013-01-04T15:10:38.68312In 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 – 2013-01-04T21:42:31.230
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 – 2013-01-04T22:13:59.410@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 – 2013-01-05T08:23:36.307
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 – 2013-01-16T17:23:09.030Does a compile-time overflow violate the rules at all? – Andrew Gray – 2013-04-08T19:03:51.570
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 – 2013-04-09T16:24:22.540