Numeric literal uses a lowercase suffix

ID

c.maintainability.uppercase_literal_suffix

Severity

low

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Readability

Language

C / C++

Description

Numeric literal $N uses a lowercase suffix. Prefer uppercase suffixes (e.g. 1U, 10L, 1.0F) because a lowercase l is easily confused with the digit 1, and consistent uppercase suffixes read more clearly. Replace the lowercase u/l/f suffix with its uppercase form.

Rationale

Numeric literal $N uses a lowercase suffix. Prefer uppercase suffixes (e.g. 1U, 10L, 1.0F) because a lowercase l is easily confused with the digit 1, and consistent uppercase suffixes read more clearly. Replace the lowercase u/l/f suffix with its uppercase form.

The following code illustrates the pattern detected by this rule:

int use(void)
{
    // FLAGGED: Numeric literal uses a lowercase suffix
    unsigned a = 1u;
    unsigned b = 1U;
    // FLAGGED: Numeric literal uses a lowercase suffix
    long c = 10l;
    long d = 10L;
    // FLAGGED: Numeric literal uses a lowercase suffix
    float e = 1.0f;
    float f = 1.0F;
    // FLAGGED: Numeric literal uses a lowercase suffix
    unsigned long g = 5ul;
    // FLAGGED: Numeric literal uses a lowercase suffix
    long long h = 7ll;
    // FLAGGED: Numeric literal uses a lowercase suffix
    float i = 1e3f;
    int hexlow = 0x1f;
    int plain = 42;
    double sci = 1e3;
    return (int)(a + b + c + d + e + f + g + h + i + hexlow + plain + sci);
}

Remediation

Follow secure coding practices and review the references below for detailed remediation guidance.

Configuration

This detector does not need any configuration.

© 2026 Xygeni. All rights reserved