C and C++


LANG.TYPE.CSUF : Confusing Literal Suffix

Summary

Lower case 'l' is used as a literal suffix.

(Using 'L' instead removes the potential for misreading as numeric character '1'.)

Properties

Class Name Confusing Literal Suffix
Significance style
Mnemonic LANG.TYPE.CSUF
Categories
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.
Availability Available for C and C++.
Enabling Checks for this warning class are disabled by default, and require the unnormalized C ASTs for the project. To enable them, add the following WARNING_FILTER rule and RETAIN_UNNORMALIZED_C_AST specification to the project configuration file.
RETAIN_UNNORMALIZED_C_AST = Yes
WARNING_FILTER += allow class="Confusing Literal Suffix"
Note that retaining the unnormalized ASTs will increase the disk space used to store the project representation, and may make the analysis take longer.

Example

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 */

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.