Function is recursive on all paths

Can anybody expain me this issue. I cannot find any explanation anywhere. Nor in help neither internet?
I have peace of code with this warning. But
1. It is not shown in code issues window.
2. It is only shown when I open the file.
3. I don't understand what the issue is. How should I solve it.

Kind Regards.

1 comment

Hello Marcin,

This means that there's no simple 'return' statement in your function and
it calls itself recursively on all control flow paths which can lead to infinite
recursion and StackOverflowException when this function is called. An example
of such function:

public void Test(int x)
{
     if(x > 0)
        Test(x-1);
     else
        Test(x-2);
}

Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Can anybody expain me this issue. I cannot find any explanation
anywhere. Nor in help neither internet?
I have peace of code with this warning. But
1. It is not shown in code issues window.
2. It is only shown when I open the file.
3. I don't understand what the issue is. How should I solve it.
Kind Regards.

---
Original message URL:
http://devnet.jetbrains.net/message/5319611#5319611



0

Please sign in to leave a comment.