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.
Please sign in to leave a 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!"