C and C++


LANG.STRUCT.COMMA : カンマ演算子の使用

要旨

カンマ演算子 (,) を使用しています。

(カンマ区切り子には適用されません。)

プロパティ

クラス名 Use of Comma Operator
日本語クラス名 カンマ演算子の使用
クラス分類 スタイル (style)
ニーモニック LANG.STRUCT.COMMA
カテゴリー
MisraC2023 MisraC2023:12.3 The comma operator should not be used
Misra2012 Misra2012:12.3 The comma operator should not be used
Misra2004 Misra2004:12.10 The comma operator shall not be used
AUTOSARC++14 AUTOSARC++14:M5-18-1 The comma operator shall not be used.
MisraC++2008 MisraC++2008:5-18-1 The comma operator shall not be used.
MisraC++2023 MisraC++2023:8.19.1 The comma operator should not be used
JSF++ JSF++:168 The comma operator shall not be used.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="Use of Comma Operator"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

int lang_struct_comma(int a, int b){         /* comma separator */
  int x,  y;                                 /* comma separator */

  x = (a++, a-b);    /* 'Use of Comma Operator' warning issued here */
  y = x;
  return y;
}

関連のある設定ファイルパラメータ

設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。