USE_CONST_FOR_VARIABLE C26496C26496 USE_CONST_FOR_VARIABLE

La variable 'variable' se asigna solo una vez, márquela como const .The variable 'variable' is assigned only once, mark it as const.

Consulte tambiénSee also

C++ Core Guidelines con. 4.C++ Core Guidelines con.4.

EjemploExample

int GetTheNumber();
int GiveMeTheNumber(int);

void function1()
{
    int theNumber = GetTheNumber(); // C26496, 'theNumber' is never assigned to again, so it can be marked as const
    std::cout << theNumber << '\n';

    GiveMeTheNumber(theNumber);
    // ...
}