Hi, android / java developers,
When a function calls a function, and this function calls another, etc., how many calls (stack length) will lead me to the stack through the stream? Is there a general rule?
The reason I ask is because I am now more efficient (design wise) for my 5-player card game.
Solution 1:
for(int i=0;i<100;i++){
p1.play();
p2.play();
p3.play();
p4.play();
}
Solution 2:
p1.play(); //where p1.play() calls p2.play() and so on until p4 calls p1 again.
// this will go on for 100 times
I prefer solution 2, so if there is a failure, I see all the function calls from p1 with i = 0 to p4 with i = 100
but with solution 1, the stack is much shorter, but when the crash occurs, I will see at the beginning of the loops the play () function being called where the crash occurred
What are you offering? I know that these are 2 questions in 1, but they are very related.
Thank you all
Snake source
share