Why is this an issue?
Using upper case literal suffixes removes the potential ambiguity between "1" (digit 1) and "l" (letter el) for declaring literals.
Noncompliant code example
const int a = 0u; // Noncompliant
const int b = 0l; // Noncompliant
const int c = 0Ul; // Noncompliant
const int d = 0x12bu; // Noncompliant
const float m = 1.2f; // Noncompliant
const float n = 1.2l; // Noncompliant
Compliant solution
const int a = 0U;
const int b = 0L;
const int c = 0UL;
const int d = 0x12bU;
const float m = 1.2F;
const float n = 1.2L;
Resources
- 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