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 |
初期化されていない変数の値を使用しようとしています。
When MOVED_FROM_UV_CHECK_ENABLED=Yes, this includes attempts to use the value of a variable that has been left in a moved-from state after applying a move constructor or move assignment (C++ code only).
使用されていない変数が未初期化の場合はこのワーニングは検出されません。
| クラス名 | Uninitialized Variable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 日本語クラス名 | 未初期化変数 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| クラス分類 | セキュリティ (security) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ニーモニック | LANG.MEM.UVAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| カテゴリー |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 対応言語 | C および C++ で利用可能です。 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル
(configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Uninitialized Variable" |
#include <iostream> #include <utility> // Example 1: simple uninitialized variable void lang_mem_uvar_simple(void){ int i,j; int *p; std::cout << j << "\n"; // 'Uninitialized Variable' warning issued here // No warnings are issued in any of the following statements. // - Each of them is dead code: executing has no effect on program state, // even though i is not initialized. // - An optimizing compiler may remove any or all of these statements. i; i + 1; &p[i]; } // Example 2: uninitialized variable due to an object being left in // moved-from state. class C { private: int *p; public: C() =default; // Default constructor constexpr C(const C&) =default; // Copy constructor C(C && other) : p(std::move(other.p)){} // Move constructor constexpr C& operator=(const C&) =default; // Copy assignment int get(void){ return p ? *p : 0; // 'Uninitialized Variable' warning issued here // when MOVED_FROM_UV_CHECK_ENABLED=Yes } }; int useC(C c){return c.get();} int lang_mem_uvar_movefrom_C(C c){ int i = 0; i += c.get(); // ok : no program path in which c is in moved-from state i += useC(std::move(c)); // c moved-from i += c.get(); // Warning issued because c is used while // in moved-from state: warning endpoint // is in the C::get() definition above. c = C(); // c no longer moved-from i += c.get(); // ok: c not in moved-from state return i; }
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。
To report problems with this documentation, please visit https://support.codesecure.com/.