C and C++


LANG.TYPE.CSUF : 紛らわしいリテラル接尾語

要旨

小文字の「l」(エル)がリテラル接尾語として使われています。

数字の「1」と間違えやすいので、「L」を使用してください。

プロパティ

クラス名 Confusing Literal Suffix
日本語クラス名 紛らわしいリテラル接尾語
クラス分類 スタイル (style)
ニーモニック LANG.TYPE.CSUF
カテゴリー
MisraC2023 MisraC2023:7.3 The lowercase character "l" shall not be used in a literal suffix
Misra2012 Misra2012:7.3 The lowercase character "l" shall not be used in a literal suffix
AUTOSARC++14 AUTOSARC++14:M2-13-4 Literal suffixes shall be upper case.
MisraC++2008 MisraC++2008:2-13-4 Literal suffixes shall be upper case.
MisraC++2023 MisraC++2023:5.13.5 The lowercase form of "L" shall not be used as the first character in a literal suffix
CWE CWE:710 Improper Adherence to Coding Standards
CERT-C CERT-C:DCL16-C Use "L," not "l," to indicate a long value
JSF++ JSF++:14 Literal suffixes shall use uppercase rather than lowercase letters.
対応言語 C および C++ で利用可能です。
有効/無効設定 このワーニングクラスのチェックはデフォルトで無効になっており、プロジェクトには非正規の C向けAST が必要になります。有効にするにはプロジェクト設定ファイル (configuration file) に以下の WARNING_FILTER ルールと RETAIN_UNNORMALIZED_C_AST 設定を追加してください。
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="Confusing Literal Suffix"
注:非正規化された AST を継続して使用した場合、使用ディスク容量が増加し解析時間が長くなる可能性があります。

unsigned long a = 0Lu;  
unsigned long b = 0lU; /* 'Confusing Literal Suffix warning issued here */
long long c = 0LL;
long long d = 0ll;     /* 'Confusing Literal Suffix warning issued here */
long double e = 1.2L;
long double f = 2.4l;  /* 'Confusing Literal Suffix warning issued here */

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

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