All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.java.rules.squid.S818.html Maven / Gradle / Ivy

There is a newer version: 8.6.0.37351
Show newest version

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

See Also

  • {rule:squid:S1129} - Long suffix "L" should be upper case




© 2015 - 2025 Weber Informatics LLC | Privacy Policy