V6097. Lowercase 'L' at the end of a long literal can be mistaken for '1'.

The analyzer has detected a declaration of a literal of type 'long' ending in a lowercase 'l'.

Consider the following example:

long value = 1111l;

In this code, the lowercase letter 'l' can be easily confused with the numeral '1'. Depending on the current font, the difference between the characters may be, in some cases, entirely unnoticeable, which may lead to misinterpretation of the literal's value. To avoid confusion, we recommend declaring literals of type 'long' with the uppercase 'L' at the end:

long value = 1111L;

This diagnostic rule does not produce the warning in every case. There are a few exceptions to it:

  • the literal ending in 'l' is used more than twice in one expression;
  • the literal is found in the declaration of the serialVersionUID field;
  • and so on.

This diagnostic is classified as:

  • CERT-DCL50-J

Bugs Found

Checked Projects
Collected Errors
14 526
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →