JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
A method call looks infinitely recursive.
This checker identifies very simple cases of infinite recusion, when a method calls itself with exactly the same parameter values. This leads very often to an infinite recursion and is likely to be a programming bug. Note, however, that, in reality, there might not be an actual infinite recursion if the state is modified by the method and termination depends on those changes of state. Although, in those cases, it could still be argued that the programmer is using a bad, unclear programming pattern and should at least clarify the code.
| クラス名 | Potential Infinite Recursion (C#) | |||
|---|---|---|---|---|
| 日本語クラス名 | Potential Infinite Recursion (C#) | |||
| クラス分類 | 信頼性 (reliability) | |||
| ニーモニック | CSHARP.FUNCS.INFREC | |||
| カテゴリー |
|
|||
| 対応言語 | C# で利用可能です。 |
|||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル
(configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Potential Infinite Recursion (C#)" |
using System;
namespace DocumentationExamples
{
public class InfiniteRecursion
{
public static void Main(string[] args)
{
Console.WriteLine(new InfiniteRecursion().Pow(args.Length));
}
public int Pow(int i)
{
int j = i;
if (i == 0)
return 1;
else
return 2 * Pow(j); // "Potential Infinite Recursion (C#)" warning issued here
}
}
}
In this example, the programmer should correct the recursive call in order to guarantee a decreasing chain of recursive parameter values:
public int Pow(int i) {
int j = i;
if (i == 0)
return 1;
else
return 2 * Pow(j - 1);
}
Check if there is an actual possibility of non-termination and correct the recursion accordingly.
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。
To report problems with this documentation, please visit https://support.codesecure.com/.