Using upper case literal suffixes removes the potential ambiguity between "1" (digit 1) and "l" (letter el) for declaring literals.
Noncompliant Code Example
long long1 = 1l; // Noncompliant
float float1 = 1.0f; // Noncompliant
double double1 = 1.0d; // Noncompliant
Compliant Solution
long long1 = 1L;
float float1 = 1.0F;
double double1 = 1.0D;
See
- MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case
- MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a literal suffix
- CERT DCL16-C - Use "L," not "l," to indicate a long value
- CERT DCL16-CPP - Use "L," not "l," to indicate a long value