Partilhar via


Aviso C26496

A variável "variable" é atribuída apenas uma vez, marque-a como const.

Confira também

Diretrizes Principais do C++ con.4.

Exemplo

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);
    // ...
}