C & C++

C & C++

Made by DeepSource

Found visually ambigious integer literal constant CXX-C2018

Bug risk
Major

Found visually ambiguous integer literal constant.

The lowercase letter 'l' (ell) can easily be confused with the digit '1' (one) when indicating that an integer literal constant is a long value. This can lead to confusion and errors in the code.

To avoid this confusion, it is recommended to use uppercase 'L' when indicating that an integer literal constant is a long value. Similarly, use uppercase 'LL' instead of lowercase 'll' when indicating that an integer literal constant is a long long value.

Bad Practice

long long int number = 1234567890ll;
long int length = 1l;

Recommended

long long int number = 1234567890LL;
long int length = 1L;

References