* I updated my previous post because i included some more code for being able to see the error in the log file
Of course this is the way the processor work. You can recurse unlimited (or as much stack you gave your program.. or other words, limited to the memory onboard). Java causes a stack pointer exception in this case. Some operating Systems offer dynamic stack adjustment and others have just a fixed stack size of whatever was given to the compiler or whatever limits the operating system (or its underlaying infrastructure). But after all it shouldn't cause the terminal.exe to crash or something like that. Therefore it may be necessary to add some sort of stack boundary protection.
It also matters how the cpu code is being executed.. some bsr, jsr command (branches) usually puts the return value on the stack. If you start recursing to much e.g.
Then this part of code basicly infinite recurses the loop until a stack overflow happens. This code for example only stores the return address to the stack. Other code variant also stores e.g. address and data registers on the stack like this.
.. until the stack is filled up. Although the compiler could also use jmp commands rather than jsr or compared branches which doesn't (at least if I recall correctly) store a return value (for what... it jumps and gone)...
To come to an end... Metatrader should handle stack execptions (and even worse division by zero exceptions) far better.. the latter (division by zero execeptions) usually leads to unresponsive (halting) code :)
my 2 cents here are that i do not believe that a language or cpu architecture should correct logical errors, as a e.g. situation of infinite loop; a OS looks more appropriate (to me at least) for such a task - or a virtual machine as we speak
Also, i have not any clue of assembly :) I might learn one day if i need to - for example if it makes sense on some embedded processors i may use :)
my 2 cents here are that i do not believe that a language or cpu architecture should correct logical errors, as a e.g. situation of infinite loop; a OS looks more appropriate (to me at least) for such task - or a virtual machine as we speak
I am grateful to all for their contributions.
I will take my time to read each suggestion to my understanding and implement it as deem fit until I get it right.
I will definitely get back to you on far I have gone with it.
You are all the best. Thanks for your support, I feel like I'm in a family and really indeed, it is a family of
selfless programmers irrespective of individual's level and knowledge.
You are all blessed.
To add comments, please log in or register